@powerhousedao/connect 5.2.0-staging.9 → 6.0.0-dev.1
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/assets/AddDriveModal-DPAIVc5B.js +1 -0
- package/dist/assets/ClearStorageModal-DDCSnHBa.js +1 -0
- package/dist/assets/CookiesPolicyModal-D5koyP0a.js +1 -0
- package/dist/assets/CreateDocumentModal-WDQNTedg.js +1 -0
- package/dist/assets/DebugSettingsModal-DWoSRmAX.js +1 -0
- package/dist/assets/DeleteDriveModal-BeubmwBZ.js +1 -0
- package/dist/assets/DeleteItemModal-DNjWQGhA.js +1 -0
- package/dist/assets/DisclaimerModal-Bl0JZtHi.js +1 -0
- package/dist/assets/DriveSettingsModal-CXQCQZHm.js +1 -0
- package/dist/assets/ExportDocumentWithErrorsModal-CqOhmcTh.js +1 -0
- package/dist/assets/SettingsModal-B-Ext2a5.js +1 -0
- package/dist/assets/UpgradeDriveModal-BTM20583.js +1 -0
- package/dist/assets/{design_system-A06C6Yf1.js → design_system-B-LWHRUh.js} +2 -2
- package/dist/assets/design_system_connect-cVSO9Msn.js +47 -0
- package/dist/assets/design_system_ui-CcOSmEq3.js +1 -0
- package/dist/assets/document_drive-Cn6j768A.js +316 -0
- package/dist/assets/{document_engineering-DyUJTCDd.js → document_engineering-D0rEhMoj.js} +1 -1
- package/dist/assets/document_model-BZM9Doht.js +230 -0
- package/dist/assets/document_model_editor-B6UOlNyW.js +25 -0
- package/dist/assets/{drive_explorer-CmtyoZn3.js → drive_explorer-CqMBWXV9.js} +2 -2
- package/dist/assets/{graphql-BS4Brs_E.js → graphql-AKTCpY7l.js} +45 -45
- package/dist/assets/{graphql-editor-XmXHvN5a.js → graphql-editor-Bz53xwVM.js} +2 -2
- package/dist/assets/{graphql_request-9RNJ00DB.js → graphql_request-BJtmW2JS.js} +1 -1
- package/dist/assets/{hooks-BErIZKfJ.js → hooks-B7GA7zmd.js} +1 -1
- package/dist/assets/index-BGt-bCk0.js +18 -0
- package/dist/assets/index-DNce0SAe.css +1 -0
- package/dist/assets/index-cGjbPuoF.js +28 -0
- package/dist/assets/{json-editor-DlieF2PT.js → json-editor-CKRAKV7M.js} +1 -1
- package/dist/assets/nodefs-Dmk3giym.js +1 -0
- package/dist/assets/{opfs-ahp-DL7h9dwT.js → opfs-ahp-DQdCBulO.js} +1 -1
- package/dist/assets/{reactor_browser-C9bmc1dB.js → reactor_browser-w_W9gLF7.js} +31 -29
- package/dist/assets/state-schemas-ChDaA9MW.js +2 -0
- package/dist/assets/zod-9j67vCAu.js +39 -0
- package/dist/index.html +14 -14
- package/lib/package.copy.json +8 -4
- package/lib/src/components/app-loader.d.ts +0 -4
- package/lib/src/components/app-loader.d.ts.map +1 -1
- package/lib/src/components/app-loader.js +2 -2
- package/lib/src/components/app-loader.js.map +1 -1
- package/lib/src/components/app.d.ts.map +1 -1
- package/lib/src/components/app.js +11 -0
- package/lib/src/components/app.js.map +1 -1
- package/lib/src/components/document-editor-container.d.ts +1 -1
- package/lib/src/components/document-editor-container.d.ts.map +1 -1
- package/lib/src/components/document-editor-container.js +19 -16
- package/lib/src/components/document-editor-container.js.map +1 -1
- package/lib/src/components/drive-editor-container.d.ts.map +1 -1
- package/lib/src/components/drive-editor-container.js +6 -9
- package/lib/src/components/drive-editor-container.js.map +1 -1
- package/lib/src/components/editors.d.ts.map +1 -1
- package/lib/src/components/editors.js +3 -9
- package/lib/src/components/editors.js.map +1 -1
- package/lib/src/components/error-boundary.d.ts +103 -0
- package/lib/src/components/error-boundary.d.ts.map +1 -0
- package/lib/src/components/error-boundary.js +104 -0
- package/lib/src/components/error-boundary.js.map +1 -0
- package/lib/src/components/modal/index.d.ts +0 -1
- package/lib/src/components/modal/index.d.ts.map +1 -1
- package/lib/src/components/modal/index.js +0 -1
- package/lib/src/components/modal/index.js.map +1 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts.map +1 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js +5 -2
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js.map +1 -1
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts +3 -4
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts.map +1 -1
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js +116 -13
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js.map +1 -1
- package/lib/src/components/modal/modals-container.js +2 -2
- package/lib/src/components/modal/modals-container.js.map +1 -1
- package/lib/src/components/sidebar.d.ts.map +1 -1
- package/lib/src/components/sidebar.js +2 -5
- package/lib/src/components/sidebar.js.map +1 -1
- package/lib/src/feature-flags.d.ts.map +1 -1
- package/lib/src/feature-flags.js +12 -8
- package/lib/src/feature-flags.js.map +1 -1
- package/lib/src/pages/content.d.ts.map +1 -1
- package/lib/src/pages/content.js +5 -5
- package/lib/src/pages/content.js.map +1 -1
- package/lib/src/store/reactor.d.ts.map +1 -1
- package/lib/src/store/reactor.js +9 -4
- package/lib/src/store/reactor.js.map +1 -1
- package/lib/src/utils/reactor.d.ts +2 -2
- package/lib/src/utils/reactor.d.ts.map +1 -1
- package/lib/src/utils/reactor.js +5 -3
- package/lib/src/utils/reactor.js.map +1 -1
- package/lib/style.css +12453 -0
- package/lib/test/utils/signer.test.js +22 -11
- package/lib/test/utils/signer.test.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.copy.json +8 -4
- package/package.json +17 -13
- package/src/index.css +1 -0
- package/dist/assets/AddDriveModal-NSVF-Mdc.js +0 -1
- package/dist/assets/ClearStorageModal-DD_JYsOg.js +0 -1
- package/dist/assets/CookiesPolicyModal--DN3PA4H.js +0 -1
- package/dist/assets/CreateDocumentModal-DvZ8e-Lk.js +0 -1
- package/dist/assets/DebugSettingsModal-CZWJH2s9.js +0 -1
- package/dist/assets/DeleteDriveModal-C0WqLyV9.js +0 -1
- package/dist/assets/DeleteItemModal-xzaro45o.js +0 -1
- package/dist/assets/DisclaimerModal-BBwmK3NU.js +0 -1
- package/dist/assets/DriveSettingsModal-IncRChmg.js +0 -1
- package/dist/assets/ExportDocumentWithErrorsModal-Co3Mgkql.js +0 -1
- package/dist/assets/SettingsModal-DG-7Po7Z.js +0 -1
- package/dist/assets/UpgradeDriveModal-C7ZsOHp2.js +0 -1
- package/dist/assets/design_system_connect-BWyThEO1.js +0 -45
- package/dist/assets/design_system_ui-lw84_Ll6.js +0 -1
- package/dist/assets/document_drive-BuVpBb4l.js +0 -316
- package/dist/assets/document_model-DB4SzBSe.js +0 -230
- package/dist/assets/document_model_editor-Bvy5ZEHe.js +0 -23
- package/dist/assets/index-BilHslhO.css +0 -1
- package/dist/assets/index-CzN3WTTB.js +0 -20
- package/dist/assets/index-DhjId3Dc.js +0 -25
- package/dist/assets/nodefs-DuVlDR-q.js +0 -1
- package/dist/assets/state-schemas-D3n-7j6n.js +0 -2
- package/dist/assets/zod-BpTyxkjy.js +0 -20
- package/lib/src/components/modal/modals-error-boundary.d.ts +0 -18
- package/lib/src/components/modal/modals-error-boundary.d.ts.map +0 -1
- package/lib/src/components/modal/modals-error-boundary.js +0 -22
- package/lib/src/components/modal/modals-error-boundary.js.map +0 -1
- package/lib/src/utils/signer.d.ts +0 -18
- package/lib/src/utils/signer.d.ts.map +0 -1
- package/lib/src/utils/signer.js +0 -215
- package/lib/src/utils/signer.js.map +0 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import{n as $e,s as L,o as ee,l as Dt,u as Rr,_ as et,a as be,b as kr,c as cn,Z as Tr,d as Se}from"./zod-9j67vCAu.js";import{g as pn,p as Dr,c as st}from"./react-DQSxOgtG.js";var at={exports:{}},Xt;function Cr(){return Xt||(Xt=1,(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=m();r.configure=m,r.stringify=r,r.default=r,t.stringify=r,t.configure=m,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function s(h){return h.length<5e3&&!i.test(h)?`"${h}"`:JSON.stringify(h)}function a(h,S){if(h.length>200||S)return h.sort(S);for(let I=1;I<h.length;I++){const x=h[I];let C=I;for(;C!==0&&h[C-1]>x;)h[C]=h[C-1],C--;h[C]=x}return h}const o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(h){return o.call(h)!==void 0&&h.length!==0}function d(h,S,I){h.length<I&&(I=h.length);const x=S===","?"":" ";let C=`"0":${x}${h[0]}`;for(let T=1;T<I;T++)C+=`${S}"${T}":${x}${h[T]}`;return C}function b(h){if(n.call(h,"circularValue")){const S=h.circularValue;if(typeof S=="string")return`"${S}"`;if(S==null)return S;if(S===Error||S===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function g(h){let S;if(n.call(h,"deterministic")&&(S=h.deterministic,typeof S!="boolean"&&typeof S!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return S===void 0?!0:S}function w(h,S){let I;if(n.call(h,S)&&(I=h[S],typeof I!="boolean"))throw new TypeError(`The "${S}" argument must be of type boolean`);return I===void 0?!0:I}function p(h,S){let I;if(n.call(h,S)){if(I=h[S],typeof I!="number")throw new TypeError(`The "${S}" argument must be of type number`);if(!Number.isInteger(I))throw new TypeError(`The "${S}" argument must be an integer`);if(I<1)throw new RangeError(`The "${S}" argument must be >= 1`)}return I===void 0?1/0:I}function E(h){return h===1?"1 item":`${h} items`}function f(h){const S=new Set;for(const I of h)(typeof I=="string"||typeof I=="number")&&S.add(String(I));return S}function _(h){if(n.call(h,"strict")){const S=h.strict;if(typeof S!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(S)return I=>{let x=`Object can not safely be stringified. Received type ${typeof I}`;throw typeof I!="function"&&(x+=` (${I.toString()})`),new Error(x)}}}function m(h){h={...h};const S=_(h);S&&(h.bigint===void 0&&(h.bigint=!1),"circularValue"in h||(h.circularValue=Error));const I=b(h),x=w(h,"bigint"),C=g(h),T=typeof C=="function"?C:void 0,F=p(h,"maximumDepth"),D=p(h,"maximumBreadth");function V(U,N,P,q,B,J){let A=N[U];switch(typeof A=="object"&&A!==null&&typeof A.toJSON=="function"&&(A=A.toJSON(U)),A=q.call(N,U,A),typeof A){case"string":return s(A);case"object":{if(A===null)return"null";if(P.indexOf(A)!==-1)return I;let R="",Y=",";const G=J;if(Array.isArray(A)){if(A.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(A),B!==""&&(J+=B,R+=`
|
|
2
|
+
${J}`,Y=`,
|
|
3
|
+
${J}`);const ce=Math.min(A.length,D);let pe=0;for(;pe<ce-1;pe++){const ge=V(String(pe),A,P,q,B,J);R+=ge!==void 0?ge:"null",R+=Y}const fe=V(String(pe),A,P,q,B,J);if(R+=fe!==void 0?fe:"null",A.length-1>D){const ge=A.length-D-1;R+=`${Y}"... ${E(ge)} not stringified"`}return B!==""&&(R+=`
|
|
4
|
+
${G}`),P.pop(),`[${R}]`}let W=Object.keys(A);const ae=W.length;if(ae===0)return"{}";if(F<P.length+1)return'"[Object]"';let ie="",re="";B!==""&&(J+=B,Y=`,
|
|
5
|
+
${J}`,ie=" ");const se=Math.min(ae,D);C&&!u(A)&&(W=a(W,T)),P.push(A);for(let ce=0;ce<se;ce++){const pe=W[ce],fe=V(pe,A,P,q,B,J);fe!==void 0&&(R+=`${re}${s(pe)}:${ie}${fe}`,re=Y)}if(ae>D){const ce=ae-D;R+=`${re}"...":${ie}"${E(ce)} not stringified"`,re=Y}return B!==""&&re.length>1&&(R=`
|
|
6
|
+
${J}${R}
|
|
7
|
+
${G}`),P.pop(),`{${R}}`}case"number":return isFinite(A)?String(A):S?S(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(A);default:return S?S(A):void 0}}function te(U,N,P,q,B,J){switch(typeof N=="object"&&N!==null&&typeof N.toJSON=="function"&&(N=N.toJSON(U)),typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(P.indexOf(N)!==-1)return I;const A=J;let R="",Y=",";if(Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N),B!==""&&(J+=B,R+=`
|
|
8
|
+
${J}`,Y=`,
|
|
9
|
+
${J}`);const ae=Math.min(N.length,D);let ie=0;for(;ie<ae-1;ie++){const se=te(String(ie),N[ie],P,q,B,J);R+=se!==void 0?se:"null",R+=Y}const re=te(String(ie),N[ie],P,q,B,J);if(R+=re!==void 0?re:"null",N.length-1>D){const se=N.length-D-1;R+=`${Y}"... ${E(se)} not stringified"`}return B!==""&&(R+=`
|
|
10
|
+
${A}`),P.pop(),`[${R}]`}P.push(N);let G="";B!==""&&(J+=B,Y=`,
|
|
11
|
+
${J}`,G=" ");let W="";for(const ae of q){const ie=te(ae,N[ae],P,q,B,J);ie!==void 0&&(R+=`${W}${s(ae)}:${G}${ie}`,W=Y)}return B!==""&&W.length>1&&(R=`
|
|
12
|
+
${J}${R}
|
|
13
|
+
${A}`),P.pop(),`{${R}}`}case"number":return isFinite(N)?String(N):S?S(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return S?S(N):void 0}}function v(U,N,P,q,B){switch(typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(U),typeof N!="object")return v(U,N,P,q,B);if(N===null)return"null"}if(P.indexOf(N)!==-1)return I;const J=B;if(Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N),B+=q;let ie=`
|
|
14
|
+
${B}`;const re=`,
|
|
15
|
+
${B}`,se=Math.min(N.length,D);let ce=0;for(;ce<se-1;ce++){const fe=v(String(ce),N[ce],P,q,B);ie+=fe!==void 0?fe:"null",ie+=re}const pe=v(String(ce),N[ce],P,q,B);if(ie+=pe!==void 0?pe:"null",N.length-1>D){const fe=N.length-D-1;ie+=`${re}"... ${E(fe)} not stringified"`}return ie+=`
|
|
16
|
+
${J}`,P.pop(),`[${ie}]`}let A=Object.keys(N);const R=A.length;if(R===0)return"{}";if(F<P.length+1)return'"[Object]"';B+=q;const Y=`,
|
|
17
|
+
${B}`;let G="",W="",ae=Math.min(R,D);u(N)&&(G+=d(N,Y,D),A=A.slice(N.length),ae-=N.length,W=Y),C&&(A=a(A,T)),P.push(N);for(let ie=0;ie<ae;ie++){const re=A[ie],se=v(re,N[re],P,q,B);se!==void 0&&(G+=`${W}${s(re)}: ${se}`,W=Y)}if(R>D){const ie=R-D;G+=`${W}"...": "${E(ie)} not stringified"`,W=Y}return W!==""&&(G=`
|
|
18
|
+
${B}${G}
|
|
19
|
+
${J}`),P.pop(),`{${G}}`}case"number":return isFinite(N)?String(N):S?S(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return S?S(N):void 0}}function j(U,N,P){switch(typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(U),typeof N!="object")return j(U,N,P);if(N===null)return"null"}if(P.indexOf(N)!==-1)return I;let q="";const B=N.length!==void 0;if(B&&Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N);const G=Math.min(N.length,D);let W=0;for(;W<G-1;W++){const ie=j(String(W),N[W],P);q+=ie!==void 0?ie:"null",q+=","}const ae=j(String(W),N[W],P);if(q+=ae!==void 0?ae:"null",N.length-1>D){const ie=N.length-D-1;q+=`,"... ${E(ie)} not stringified"`}return P.pop(),`[${q}]`}let J=Object.keys(N);const A=J.length;if(A===0)return"{}";if(F<P.length+1)return'"[Object]"';let R="",Y=Math.min(A,D);B&&u(N)&&(q+=d(N,",",D),J=J.slice(N.length),Y-=N.length,R=","),C&&(J=a(J,T)),P.push(N);for(let G=0;G<Y;G++){const W=J[G],ae=j(W,N[W],P);ae!==void 0&&(q+=`${R}${s(W)}:${ae}`,R=",")}if(A>D){const G=A-D;q+=`${R}"...":"${E(G)} not stringified"`}return P.pop(),`{${q}}`}case"number":return isFinite(N)?String(N):S?S(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return S?S(N):void 0}}function c(U,N,P){if(arguments.length>1){let q="";if(typeof P=="number"?q=" ".repeat(Math.min(P,10)):typeof P=="string"&&(q=P.slice(0,10)),N!=null){if(typeof N=="function")return V("",{"":U},[],N,q,"");if(Array.isArray(N))return te("",U,[],f(N),q,"")}if(q.length!==0)return v("",U,[],q,"")}return j("",U,[])}return c}})(at,at.exports)),at.exports}var Mr=Cr();const _t=pn(Mr);_t.configure;const Kt=_t,Nr=[1518500249,1859775393,-1894007588,-899497514];function Pr(e){return new zr}class zr{constructor(){this.A=1732584193,this.B=-271733879,this.C=-1732584194,this.D=271733878,this.E=-1009589776,this._size=0,this._sp=0,(!lt||Ve>=8e3)&&(lt=new ArrayBuffer(8e3),Ve=0),this._byte=new Uint8Array(lt,Ve,80),this._word=new Int32Array(lt,Ve,20),Ve+=80}update(t){if(typeof t=="string")return this._utf8(t);if(t==null)throw new TypeError("Invalid type: "+typeof t);const n=t.byteOffset,r=t.byteLength;let i=r/64|0,s=0;if(i&&!(n&3)&&!(this._size%64)){const o=new Int32Array(t.buffer,n,i*16);for(;i--;)this._int32(o,s>>2),s+=64;this._size+=s}if(t.BYTES_PER_ELEMENT!==1&&t.buffer){const o=new Uint8Array(t.buffer,n+s,r-s);return this._uint8(o)}return s===r?this:this._uint8(t,s)}_uint8(t,n){const{_byte:r,_word:i}=this,s=t.length;for(n=n|0;n<s;){const a=this._size%64;let o=a;for(;n<s&&o<64;)r[o++]=t[n++];o>=64&&this._int32(i),this._size+=o-a}return this}_utf8(t){const{_byte:n,_word:r}=this,i=t.length;let s=this._sp;for(let a=0;a<i;){const o=this._size%64;let u=o;for(;a<i&&u<64;){let d=t.charCodeAt(a++)|0;d<128?n[u++]=d:d<2048?(n[u++]=192|d>>>6,n[u++]=128|d&63):d<55296||d>57343?(n[u++]=224|d>>>12,n[u++]=128|d>>>6&63,n[u++]=128|d&63):s?(d=((s&1023)<<10)+(d&1023)+65536,n[u++]=240|d>>>18,n[u++]=128|d>>>12&63,n[u++]=128|d>>>6&63,n[u++]=128|d&63,s=0):s=d}u>=64&&(this._int32(r),r[0]=r[16]),this._size+=u-o}return this._sp=s,this}_int32(t,n){let{A:r,B:i,C:s,D:a,E:o}=this,u=0;for(n=n|0;u<16;)Ne[u++]=Ce(t[n++]);for(u=16;u<80;u++)Ne[u]=jr(Ne[u-3]^Ne[u-8]^Ne[u-14]^Ne[u-16]);for(u=0;u<80;u++){const d=u/20|0,b=Br(r)+$r(d,i,s,a)+o+Ne[u]+Nr[d]|0;o=a,a=s,s=Fr(i),i=r,r=b}this.A=r+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=o+this.E|0}digest(t){const{_byte:n,_word:r}=this;let i=this._size%64|0;for(n[i++]=128;i&3;)n[i++]=0;if(i>>=2,i>14){for(;i<16;)r[i++]=0;i=0,this._int32(r)}for(;i<16;)r[i++]=0;const s=this._size*8,a=(s&4294967295)>>>0,o=(s-a)/4294967296;return o&&(r[14]=Ce(o)),a&&(r[15]=Ce(a)),this._int32(r),t==="hex"?this._hex():this._bin()}_hex(){const{A:t,B:n,C:r,D:i,E:s}=this;return Ge(t)+Ge(n)+Ge(r)+Ge(i)+Ge(s)}_bin(){const{A:t,B:n,C:r,D:i,E:s,_byte:a,_word:o}=this;return o[0]=Ce(t),o[1]=Ce(n),o[2]=Ce(r),o[3]=Ce(i),o[4]=Ce(s),a.slice(0,20)}}const Ne=new Int32Array(80);let lt,Ve=0;const Ge=e=>(e+4294967296).toString(16).substr(-8),Lr=(e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255),Ur=(e=>e),Ce=Wr()?Ur:Lr,jr=e=>e<<1|e>>>31,Br=e=>e<<5|e>>>27,Fr=e=>e<<30|e>>>2;function $r(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}function Wr(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const Ct=(e,t="sha1",n="base64",r)=>{if(!["sha1"].includes(t))throw new Error(`Hashing algorithm not supported: "${t}". Available: sha1`);if(!["base64","hex"].includes(n))throw new Error(`Hash encoding not supported: "${n}". Available: base64, hex`);const i=Vr(e,t);return n==="hex"?Zr(i):Hr(i)};function Hr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Zr(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Vr(e,t="sha1"){if(!["sha1"].includes(t))throw new Error("Hashing algorithm not supported: Available: sha1");return Pr().update(e).digest()}function Gr(e){return(new Date(e).getTime()/1e3).toFixed(0)}function Xr({documentId:e,signer:t,action:n,previousStateHash:r}){const{scope:i,type:s}=n;return[Gr(new Date),t.app.key,Ct([e,i,s,_t(n.input)].join("")),r]}const Kr=new TextEncoder;function Jr(e){const t=e.join(""),n=`Signed Operation:
|
|
20
|
+
`+t.length.toString();return Kr.encode(n+t)}function qr(e){const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Array.prototype.map.call(t,n=>("00"+n.toString(16)).slice(-2)).join("")}class dn extends Error{data;constructor(t){super(),this.name="InvalidActionInputError",this.data=t,this.message=this.message||`Invalid action input: ${JSON.stringify(t,null,2)}`}}class Yr extends dn{issues;constructor(t){super(t),this.issues=t,this.name="InvalidActionInputZodError"}}class Qr extends Error{_scope;_document;_operation;constructor(t,n,r){super(),this.name="HashMismatchError",this._document=n,this._scope=t,this._operation=r,this.message=JSON.stringify({error:`Hash mismatch on document ${n.header.id}, scope ${t}, index ${r.index}`,document:n,operation:r},null,1)}get document(){return this._document}get scope(){return this._scope}get operation(){return this._operation}}const ei=e=>e!=null;kr().refine(e=>ei(e));const ti=et(["LOAD_STATE"]),ni=et(["PRUNE"]),ri=et(["REDO"]),ii=et(["SET_NAME"]),oi=et(["UNDO"]);function Le(){return L()}function si(){return Rr([ai(),ui(),ci(),pi(),di()])}function ai(){return ee({id:L(),timestampUtcMs:L(),input:Dt(()=>fn()),type:ti,scope:Le()})}function fn(){return ee({operations:$e(),state:Dt(()=>li())})}function li(){return ee({data:cn().nullish(),name:L()})}function ui(){return ee({id:L(),timestampUtcMs:L(),input:Dt(()=>hn()),type:ni,scope:Le()})}function hn(){return ee({end:$e().nullish(),start:$e().nullish()})}const mn=$e;function ci(){return ee({id:L(),timestampUtcMs:L().datetime(),input:mn(),type:ri,scope:Le()})}const gn=L;function pi(){return ee({id:L(),timestampUtcMs:L().datetime(),input:gn(),type:ii,scope:be("global")})}const _n=$e;function di(){return ee({id:L(),timestampUtcMs:L().datetime(),input:_n(),type:oi,scope:Le()})}function bn(e){return globalThis.crypto.randomUUID()}function yn(e,t,n,r){const i=`${e}:${t}:${n}:${r}`;return Ct(i,"sha1","hex").slice(0,32)}const fi=(e=1,t="global")=>oe("UNDO",e,void 0,_n,t),hi=(e=1,t="global")=>oe("REDO",e,void 0,mn,t),mi=(e,t,n="global")=>oe("PRUNE",{start:e,end:t},void 0,hn,n),En=(e,t)=>oe("LOAD_STATE",{state:e,operations:t},void 0,fn),Mt=(e="global")=>oe("NOOP",{},void 0,void 0,e);function oe(e,t,n,r,i="global"){if(!e)throw new Error("Empty action type");if(typeof e!="string")throw new Error(`Invalid action type: ${JSON.stringify(e)}`);const s={id:bn(),timestampUtcMs:new Date().toISOString(),type:e,input:t,scope:i};try{r?.().parse(s.input)}catch(a){throw a instanceof Tr?new Yr(a.issues):new dn(a)}return s}const gi=e=>({id:e.id,timestampUtcMs:e.timestampUtcMs,type:e.type,input:e.input,scope:e.scope,context:e.context,attachments:e.attachments}),_i=(e,t,n,r)=>({...e,action:e,id:yn(r.documentId,r.scope,r.branch,e.id),timestampUtcMs:new Date().toISOString(),hash:"",error:void 0,index:t,skip:n}),bi=(e,t,n,r)=>{const i=yn(r.documentId,r.scope,r.branch,e.action.id);return{...e,hash:"",error:void 0,index:t,skip:n,id:i}},yi=(e,t)=>{if(!e.action)throw new Error("Operation has no action");return{...e,action:{...e.action,context:t}}},Ei=(e,t,n=[])=>({user:e,app:t,signatures:n});async function Si(e,t){const n=Xr(e),r=Jr(n),i=await t(r);return[...n,`0x${qr(i)}`]}async function pa(e,t,n,r,i){const a=t(n,e,void 0,{reuseOperationResultingState:!0}).operations[e.scope];if(!a)throw new Error(`No operations found for scope: ${e.scope}`);const o=a.at(-1);if(!o)throw new Error("Action was not applied");const u=a.at(-2)?.hash??"",d=await Si({documentId:n.header.id,signer:r,action:e,previousStateHash:u},i),b={signer:Ei(r.user,r.app,[...r.signatures,d])};return yi(o,b)}const Oi=e=>`${e.documentType}:${e.createdAtUtcIso}:${e.nonce}`;function wi(e){let t;return{async publicKey(){return e},async sign(n){throw new Error("verification-only signer cannot sign data")},async signAction(n,r){throw new Error("verification-only signer cannot sign actions")},async verify(n,r){t||(t=await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"]));let i;try{i=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},t,new Uint8Array(r),new Uint8Array(n))}catch{throw new Error("invalid signature")}if(!i)throw new Error("invalid signature")}}}const xi=e=>wi(e.sig.publicKey),vi=async(e,t,n)=>{const r=Oi(e),s=new TextEncoder().encode(r),a=Uint8Array.from(atob(t),o=>o.charCodeAt(0));await n.verify(s,a)},da=async e=>{const t=xi(e);return vi({documentType:e.documentType,createdAtUtcIso:e.createdAtUtcIso,nonce:e.sig.nonce},e.id,t)},Ii=(e=bn(),t="")=>({id:e,sig:{publicKey:{},nonce:""},documentType:t,createdAtUtcIso:new Date().toISOString(),slug:"",name:"",branch:"main",revision:{document:0},lastModifiedAtUtcIso:new Date().toISOString(),meta:{}});function Ai(e){return["UNDO","REDO"].includes(e.type)}function Jt(e){return e.type==="UNDO"}function Sn(e){return["SET_NAME","UNDO","REDO","PRUNE","LOAD_STATE"].includes(e.type)}function Ri(e,t){const n=e(t);return{header:Ii(),state:n,initialState:n,operations:{global:[],local:[]},clipboard:[]}}function Nt(e,t="global"){const n=_t(e.state[t]||"");return Ct(n)}function ki(e){const t=[];let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];"action"in i&&i.action.type==="NOOP"&&i.skip>0?(n++,t.unshift(i)):n>0?n--:t.unshift(i)}return t}const Ti=e=>e;function On(e,t,n,r,i,s={},a){const{checkHashes:o=!0,reuseOperationResultingState:u,operationResultingStateParser:d=Pt,skipIndexValidation:b}=a||{};let g=e;const w=[],p=new Set([...Object.keys(t),"global","local"]),E={};for(const x of p)E[x]=[];if(u)for(const[x,C]of Object.entries(t)){if(!C)continue;const T=C.findLastIndex(D=>!!D.resultingState);if(T<0){w.push(...C);continue}const F=C[T];if(!(!F||!F.resultingState))try{const D=d(F.resultingState);g={...g,[x]:D};const V=E[x];V&&V.push(...C.slice(0,T+1)),w.push(...C.slice(T+1))}catch{w.push(...C)}}else w.push(...Object.values(t).flatMap(x=>x||[]));const f={header:r,state:Ti(g),initialState:e,operations:E,clipboard:[]};let _=f;if(w.length)_=w.reduce((x,C)=>n(x,C.action,i,{ignoreSkipOperations:!0,checkHashes:o,skipIndexValidation:b,replayOptions:{operation:C}}),f);else for(const x of Object.values(E)){if(!x)continue;const C=x.at(-1);C&&(_=xn(_,C.action.scope))}if(!o)for(const x of Object.keys(_.state))for(let C=w.length-1;C>=0;C--){const T=w[C];if(T.action.scope===x){if(T.hash!==Nt(_,x))throw new Qr(x,_,T);break}}const m=new Set([...Object.keys(_.operations),...Object.keys(t),"global","local"]),h={};for(const x of m)h[x]=[];const S=Array.from(m).reduce((x,C)=>{const T=_.operations[C]||[];return{...x,[C]:[...T.map((F,D)=>({...F,timestamp:t[C]?.[D]?.timestampUtcMs??F.timestampUtcMs}))]}},h),I=r?r.lastModifiedAtUtcIso:Object.values(S).reduce((x,C)=>{if(!C)return x;const T=C.at(-1);return T&&T.timestampUtcMs>x?T.timestampUtcMs:x},f.header.lastModifiedAtUtcIso);return r&&(_.header={...r,revision:_.header.revision,lastModifiedAtUtcIso:I}),{..._,operations:S}}function Pt(e){const t=typeof e;if(t==="string")return JSON.parse(e);if(t==="object")return e;throw new Error(`Providing resulting state is of type: ${t}`)}var qt;(function(e){e.UNEXPECTED_INDEX="UNEXPECTED_INDEX"})(qt||(qt={}));var Yt;(function(e){e.DUPLICATED_INDEX="DUPLICATED_INDEX",e.MISSING_INDEX="MISSING_INDEX"})(Yt||(Yt={}));function ke(e){const t=[];let n=e.length-1;for(;n>-1;){t.unshift(e[n]);const r=(e[n]?.index||0)-(e[n]?.skip||0)-1;let i=n-1;for(;i>-1&&(e[i]?.index||0)>r;)i--;n=i}return t}function we(e){return e.slice().sort((t,n)=>t.skip-n.skip).sort((t,n)=>t.index-n.index)}function fa(e,t,n){return[...t,...n].sort((r,i)=>new Date(r.timestampUtcMs||"").getTime()-new Date(i.timestampUtcMs||"").getTime()).map((r,i)=>({...r,index:e.index+i,skip:i===0?e.skip:0}))}function wn(e,t){const n=e,r=t,i={index:n.index,skip:n.skip,type:n.type??null,scope:n.scope??null,input:n.input??null},s={index:r.index,skip:r.skip,type:r.type??null,scope:r.scope??null,input:r.input??null};return Kt(i)===Kt(s)}function ha(e,t){const n=ke(we(e.slice())),r=ke(we(t.slice()));if(n.length<1)return[r,[]];const i=[];let s=!1;for(;r.length>0;){const a=r[0];let o=n.shift();for(;o&&Di(o,a);)i.push(o),o=n.shift();if(o?s||(wn(o,a)?(r.shift(),i.push(o)):(n.unshift(o),s=!0)):s=!0,s){let u=r.shift();for(;u;)i.push(u),u=r.shift()}}if(!s){let a=n.shift();for(;a;)i.push(a),a=n.shift()}return[ke(i),n]}function Di(e,t){return e.index<t.index||e.index===t.index&&e.id===t.id&&e.skip<t.skip}function Ci(e,t){const n=[],r=[],i=[],s=Math.max(e.length,t.length);let a=!1;for(let o=0;o<s;o++){const u=e[o],d=t[o];u&&d?!a&&wn(u,d)?n.push(u):(a=!0,r.push(u),i.push(d)):u?r.push(u):d&&i.push(d)}return[n,r,i]}function ma(e,t,n){const[r,i,s]=Ci(ke(e),ke(t)),a=Ot(r),o=1+Math.max(a,Ot(i),Ot(s)),u=Pi(s,i),d=n({index:o,skip:o-(a+1)},i,u);return r.concat(d)}function Ot(e){const t=e[e.length-1];return t?t.index:-1}function Mi(e){if(e.length<1)return-1;const t=ke(e);let n=(t[t.length-1]?.skip||0)+1;return t.length>1&&(n+=t[t.length-2]?.skip||0),(t[t.length-1]?.index||-1)<n?-1:n}function ga(e){return e.reduce((n,r)=>(n[r.action.scope]||(n[r.action.scope]=[]),n[r.action.scope]?.push(r),n),{})}function _a(e,t){return e.filter(n=>!t.some(r=>n.action.type==="NOOP"&&n.skip===0&&n.index===r.index||n.index===r.index&&n.skip===r.skip&&n.action.scope===r.action.scope&&n.hash===r.hash&&n.action.type===r.action.type))}function Ni(e,t){const r=we(e).at(-1)?.index??-1,i=r+1,s={...t,index:t.index??i};if(s.index<r)throw new Error(`The skip header operation index must be greater than or equal to ${r}`);return ke(we([...e,s])).slice(0,-1)}function ft(e){return Object.entries(e).reduce((n,r)=>{const[i,s]=r;return s?{...n,[i]:ke(we(s))}:n},{})}function Pi(e,t){return e.filter(n=>n.id?!t.some(r=>r.id===n.id):!0)}function zi(e){return e?Object.entries(e).reduce((n,[r,i])=>i?{...n,[r]:i.map(s=>{const{resultingState:a,...o}=s;return o})}:n,{}):{}}function Li(e,t){return e.filter(n=>!t.some(r=>n.index===r.index))}function Ui(e){return we(Object.values(e.operations).flatMap(n=>n||[])).at(-1)?.timestampUtcMs||e.header.lastModifiedAtUtcIso}function ji(e,t){return(e.operations[t]?.at(-1)?.index??-1??-1)+1}function xn(e,t){const n={...e.header,revision:{...e.header.revision,[t]:ji(e,t)},lastModifiedAtUtcIso:Ui(e)};return{...e,header:n}}function ut(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wt={exports:{}},Qt;function Bi(){return Qt||(Qt=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,i,s){function a(d,b){if(!i[d]){if(!r[d]){var g=typeof ut=="function"&&ut;if(!b&&g)return g(d,!0);if(o)return o(d,!0);var w=new Error("Cannot find module '"+d+"'");throw w.code="MODULE_NOT_FOUND",w}var p=i[d]={exports:{}};r[d][0].call(p.exports,function(E){var f=r[d][1][E];return a(f||E)},p,p.exports,n,r,i,s)}return i[d].exports}for(var o=typeof ut=="function"&&ut,u=0;u<s.length;u++)a(s[u]);return a})({1:[function(n,r,i){var s=n("./utils"),a=n("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(u){for(var d,b,g,w,p,E,f,_=[],m=0,h=u.length,S=h,I=s.getTypeOf(u)!=="string";m<u.length;)S=h-m,g=I?(d=u[m++],b=m<h?u[m++]:0,m<h?u[m++]:0):(d=u.charCodeAt(m++),b=m<h?u.charCodeAt(m++):0,m<h?u.charCodeAt(m++):0),w=d>>2,p=(3&d)<<4|b>>4,E=1<S?(15&b)<<2|g>>6:64,f=2<S?63&g:64,_.push(o.charAt(w)+o.charAt(p)+o.charAt(E)+o.charAt(f));return _.join("")},i.decode=function(u){var d,b,g,w,p,E,f=0,_=0,m="data:";if(u.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var h,S=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===o.charAt(64)&&S--,u.charAt(u.length-2)===o.charAt(64)&&S--,S%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=a.uint8array?new Uint8Array(0|S):new Array(0|S);f<u.length;)d=o.indexOf(u.charAt(f++))<<2|(w=o.indexOf(u.charAt(f++)))>>4,b=(15&w)<<4|(p=o.indexOf(u.charAt(f++)))>>2,g=(3&p)<<6|(E=o.indexOf(u.charAt(f++))),h[_++]=d,p!==64&&(h[_++]=b),E!==64&&(h[_++]=g);return h}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),a=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function d(b,g,w,p,E){this.compressedSize=b,this.uncompressedSize=g,this.crc32=w,this.compression=p,this.compressedContent=E}d.prototype={getContentWorker:function(){var b=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),g=this;return b.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(b,g,w){return b.pipe(new o).pipe(new u("uncompressedSize")).pipe(g.compressWorker(w)).pipe(new u("compressedSize")).withStreamInfo("compression",g)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),a=(function(){for(var o,u=[],d=0;d<256;d++){o=d;for(var b=0;b<8;b++)o=1&o?3988292384^o>>>1:o>>>1;u[d]=o}return u})();r.exports=function(o,u){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?(function(d,b,g,w){var p=a,E=w+g;d^=-1;for(var f=w;f<E;f++)d=d>>>8^p[255&(d^b[f])];return-1^d})(0|u,o,o.length,0):(function(d,b,g,w){var p=a,E=w+g;d^=-1;for(var f=w;f<E;f++)d=d>>>8^p[255&(d^b.charCodeAt(f))];return-1^d})(0|u,o,o.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=n("pako"),o=n("./utils"),u=n("./stream/GenericWorker"),d=s?"uint8array":"array";function b(g,w){u.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=w,this.meta={}}i.magic="\b\0",o.inherits(b,u),b.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(d,g.data),!1)},b.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(w){g.push({data:w,meta:g.meta})}},i.compressWorker=function(g){return new b("Deflate",g)},i.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(p,E){var f,_="";for(f=0;f<E;f++)_+=String.fromCharCode(255&p),p>>>=8;return _}function a(p,E,f,_,m,h){var S,I,x=p.file,C=p.compression,T=h!==d.utf8encode,F=o.transformTo("string",h(x.name)),D=o.transformTo("string",d.utf8encode(x.name)),V=x.comment,te=o.transformTo("string",h(V)),v=o.transformTo("string",d.utf8encode(V)),j=D.length!==x.name.length,c=v.length!==V.length,U="",N="",P="",q=x.dir,B=x.date,J={crc32:0,compressedSize:0,uncompressedSize:0};E&&!f||(J.crc32=p.crc32,J.compressedSize=p.compressedSize,J.uncompressedSize=p.uncompressedSize);var A=0;E&&(A|=8),T||!j&&!c||(A|=2048);var R=0,Y=0;q&&(R|=16),m==="UNIX"?(Y=798,R|=(function(W,ae){var ie=W;return W||(ie=ae?16893:33204),(65535&ie)<<16})(x.unixPermissions,q)):(Y=20,R|=(function(W){return 63&(W||0)})(x.dosPermissions)),S=B.getUTCHours(),S<<=6,S|=B.getUTCMinutes(),S<<=5,S|=B.getUTCSeconds()/2,I=B.getUTCFullYear()-1980,I<<=4,I|=B.getUTCMonth()+1,I<<=5,I|=B.getUTCDate(),j&&(N=s(1,1)+s(b(F),4)+D,U+="up"+s(N.length,2)+N),c&&(P=s(1,1)+s(b(te),4)+v,U+="uc"+s(P.length,2)+P);var G="";return G+=`
|
|
21
|
+
\0`,G+=s(A,2),G+=C.magic,G+=s(S,2),G+=s(I,2),G+=s(J.crc32,4),G+=s(J.compressedSize,4),G+=s(J.uncompressedSize,4),G+=s(F.length,2),G+=s(U.length,2),{fileRecord:g.LOCAL_FILE_HEADER+G+F+U,dirRecord:g.CENTRAL_FILE_HEADER+s(Y,2)+G+s(te.length,2)+"\0\0\0\0"+s(R,4)+s(_,4)+F+U+te}}var o=n("../utils"),u=n("../stream/GenericWorker"),d=n("../utf8"),b=n("../crc32"),g=n("../signature");function w(p,E,f,_){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=E,this.zipPlatform=f,this.encodeFileName=_,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(w,u),w.prototype.push=function(p){var E=p.meta.percent||0,f=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,u.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:f?(E+100*(f-_-1))/f:100}}))},w.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var E=this.streamFiles&&!p.file.dir;if(E){var f=a(p,E,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(p){this.accumulate=!1;var E=this.streamFiles&&!p.file.dir,f=a(p,E,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),E)this.push({data:(function(_){return g.DATA_DESCRIPTOR+s(_.crc32,4)+s(_.compressedSize,4)+s(_.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var p=this.bytesWritten,E=0;E<this.dirRecords.length;E++)this.push({data:this.dirRecords[E],meta:{percent:100}});var f=this.bytesWritten-p,_=(function(m,h,S,I,x){var C=o.transformTo("string",x(I));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(m,2)+s(m,2)+s(h,4)+s(S,4)+s(C.length,2)+C})(this.dirRecords.length,f,p,this.zipComment,this.encodeFileName);this.push({data:_,meta:{percent:100}})},w.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},w.prototype.registerPrevious=function(p){this._sources.push(p);var E=this;return p.on("data",function(f){E.processChunk(f)}),p.on("end",function(){E.closedSource(E.previous.streamInfo),E._sources.length?E.prepareNextSource():E.end()}),p.on("error",function(f){E.error(f)}),this},w.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},w.prototype.error=function(p){var E=this._sources;if(!u.prototype.error.call(this,p))return!1;for(var f=0;f<E.length;f++)try{E[f].error(p)}catch{}return!0},w.prototype.lock=function(){u.prototype.lock.call(this);for(var p=this._sources,E=0;E<p.length;E++)p[E].lock()},r.exports=w},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var s=n("../compressions"),a=n("./ZipFileWorker");i.generateWorker=function(o,u,d){var b=new a(u.streamFiles,d,u.platform,u.encodeFileName),g=0;try{o.forEach(function(w,p){g++;var E=(function(h,S){var I=h||S,x=s[I];if(!x)throw new Error(I+" is not a valid compression method !");return x})(p.options.compression,u.compression),f=p.options.compressionOptions||u.compressionOptions||{},_=p.dir,m=p.date;p._compressWorker(E,f).withStreamInfo("file",{name:w,dir:_,date:m,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(b)}),b.entriesCount=g}catch(w){b.error(w)}return b}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(a,o){return new s().loadAsync(a,o)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var s=n("./utils"),a=n("./external"),o=n("./utf8"),u=n("./zipEntries"),d=n("./stream/Crc32Probe"),b=n("./nodejsUtils");function g(w){return new a.Promise(function(p,E){var f=w.decompressed.getContentWorker().pipe(new d);f.on("error",function(_){E(_)}).on("end",function(){f.streamInfo.crc32!==w.decompressed.crc32?E(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(w,p){var E=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),b.isNode&&b.isStream(w)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",w,!0,p.optimizedBinaryString,p.base64).then(function(f){var _=new u(p);return _.load(f),_}).then(function(f){var _=[a.Promise.resolve(f)],m=f.files;if(p.checkCRC32)for(var h=0;h<m.length;h++)_.push(g(m[h]));return a.Promise.all(_)}).then(function(f){for(var _=f.shift(),m=_.files,h=0;h<m.length;h++){var S=m[h],I=S.fileNameStr,x=s.resolve(S.fileNameStr);E.file(x,S.decompressed,{binary:!0,optimizedBinaryString:!0,date:S.date,dir:S.dir,comment:S.fileCommentStr.length?S.fileCommentStr:null,unixPermissions:S.unixPermissions,dosPermissions:S.dosPermissions,createFolders:p.createFolders}),S.dir||(E.file(x).unsafeOriginalName=I)}return _.zipComment.length&&(E.comment=_.zipComment),E})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,i){var s=n("../utils"),a=n("../stream/GenericWorker");function o(u,d){a.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(d)}s.inherits(o,a),o.prototype._bindStream=function(u){var d=this;(this._stream=u).pause(),u.on("data",function(b){d.push({data:b,meta:{percent:0}})}).on("error",function(b){d.isPaused?this.generatedError=b:d.error(b)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},o.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var s=n("readable-stream").Readable;function a(o,u,d){s.call(this,u),this._helper=o;var b=this;o.on("data",function(g,w){b.push(g)||b._helper.pause(),d&&d(w)}).on("error",function(g){b.emit("error",g)}).on("end",function(){b.push(null)})}n("../utils").inherits(a,s),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,i){function s(x,C,T){var F,D=o.getTypeOf(C),V=o.extend(T||{},b);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(x=m(x)),V.createFolders&&(F=_(x))&&h.call(this,F,!0);var te=D==="string"&&V.binary===!1&&V.base64===!1;T&&T.binary!==void 0||(V.binary=!te),(C instanceof g&&C.uncompressedSize===0||V.dir||!C||C.length===0)&&(V.base64=!1,V.binary=!0,C="",V.compression="STORE",D="string");var v=null;v=C instanceof g||C instanceof u?C:E.isNode&&E.isStream(C)?new f(x,C):o.prepareContent(x,C,V.binary,V.optimizedBinaryString,V.base64);var j=new w(x,v,V);this.files[x]=j}var a=n("./utf8"),o=n("./utils"),u=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),b=n("./defaults"),g=n("./compressedObject"),w=n("./zipObject"),p=n("./generate"),E=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),_=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var C=x.lastIndexOf("/");return 0<C?x.substring(0,C):""},m=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},h=function(x,C){return C=C!==void 0?C:b.createFolders,x=m(x),this.files[x]||s.call(this,x,null,{dir:!0,createFolders:C}),this.files[x]};function S(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var I={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var C,T,F;for(C in this.files)F=this.files[C],(T=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&x(T,F)},filter:function(x){var C=[];return this.forEach(function(T,F){x(T,F)&&C.push(F)}),C},file:function(x,C,T){if(arguments.length!==1)return x=this.root+x,s.call(this,x,C,T),this;if(S(x)){var F=x;return this.filter(function(V,te){return!te.dir&&F.test(V)})}var D=this.files[this.root+x];return D&&!D.dir?D:null},folder:function(x){if(!x)return this;if(S(x))return this.filter(function(D,V){return V.dir&&x.test(D)});var C=this.root+x,T=h.call(this,C),F=this.clone();return F.root=T.name,F},remove:function(x){x=this.root+x;var C=this.files[x];if(C||(x.slice(-1)!=="/"&&(x+="/"),C=this.files[x]),C&&!C.dir)delete this.files[x];else for(var T=this.filter(function(D,V){return V.name.slice(0,x.length)===x}),F=0;F<T.length;F++)delete this.files[T[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(x){var C,T={};try{if((T=o.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=T.type.toLowerCase(),T.compression=T.compression.toUpperCase(),T.type==="binarystring"&&(T.type="string"),!T.type)throw new Error("No output type specified.");o.checkSupport(T.type),T.platform!=="darwin"&&T.platform!=="freebsd"&&T.platform!=="linux"&&T.platform!=="sunos"||(T.platform="UNIX"),T.platform==="win32"&&(T.platform="DOS");var F=T.comment||this.comment||"";C=p.generateWorker(this,T,F)}catch(D){(C=new u("error")).error(D)}return new d(C,T.type||"string",T.mimeType)},generateAsync:function(x,C){return this.generateInternalStream(x).accumulate(C)},generateNodeStream:function(x,C){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(C)}};r.exports=I},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,i){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,i){var s=n("./DataReader");function a(o){s.call(this,o);for(var u=0;u<this.data.length;u++)o[u]=255&o[u]}n("../utils").inherits(a,s),a.prototype.byteAt=function(o){return this.data[this.zero+o]},a.prototype.lastIndexOfSignature=function(o){for(var u=o.charCodeAt(0),d=o.charCodeAt(1),b=o.charCodeAt(2),g=o.charCodeAt(3),w=this.length-4;0<=w;--w)if(this.data[w]===u&&this.data[w+1]===d&&this.data[w+2]===b&&this.data[w+3]===g)return w-this.zero;return-1},a.prototype.readAndCheckSignature=function(o){var u=o.charCodeAt(0),d=o.charCodeAt(1),b=o.charCodeAt(2),g=o.charCodeAt(3),w=this.readData(4);return u===w[0]&&d===w[1]&&b===w[2]&&g===w[3]},a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var s=n("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var u,d=0;for(this.checkOffset(o),u=this.index+o-1;u>=this.index;u--)d=(d<<8)+this.byteAt(u);return this.index+=o,d},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=a},{"../utils":32}],19:[function(n,r,i){var s=n("./Uint8ArrayReader");function a(o){s.call(this,o)}n("../utils").inherits(a,s),a.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var s=n("./DataReader");function a(o){s.call(this,o)}n("../utils").inherits(a,s),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var s=n("./ArrayReader");function a(o){s.call(this,o)}n("../utils").inherits(a,s),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var s=n("../utils"),a=n("../support"),o=n("./ArrayReader"),u=n("./StringReader"),d=n("./NodeBufferReader"),b=n("./Uint8ArrayReader");r.exports=function(g){var w=s.getTypeOf(g);return s.checkSupport(w),w!=="string"||a.uint8array?w==="nodebuffer"?new d(g):a.uint8array?new b(s.transformTo("uint8array",g)):new o(s.transformTo("array",g)):new u(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var s=n("./GenericWorker"),a=n("../utils");function o(u){s.call(this,"ConvertWorker to "+u),this.destType=u}a.inherits(o,s),o.prototype.processChunk=function(u){this.push({data:a.transformTo(this.destType,u.data),meta:u.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var s=n("./GenericWorker"),a=n("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,s),o.prototype.processChunk=function(u){this.streamInfo.crc32=a(u.data,this.streamInfo.crc32||0),this.push(u)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var s=n("../utils"),a=n("./GenericWorker");function o(u){a.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}s.inherits(o,a),o.prototype.processChunk=function(u){if(u){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+u.data.length}a.prototype.processChunk.call(this,u)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var s=n("../utils"),a=n("./GenericWorker");function o(u){a.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(b){d.dataIsReady=!0,d.data=b,d.max=b&&b.length||0,d.type=s.getTypeOf(b),d.isPaused||d._tickAndRepeat()},function(b){d.error(b)})}s.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,d);break;case"uint8array":u=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":u=this.data.slice(this.index,d)}return this.index=d,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var u=0;u<this._listeners[a].length;u++)this._listeners[a][u].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(u){o.processChunk(u)}),a.on("end",function(){o.end()}),a.on("error",function(u){o.error(u)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=s},{}],29:[function(n,r,i){var s=n("../utils"),a=n("./ConvertWorker"),o=n("./GenericWorker"),u=n("../base64"),d=n("../support"),b=n("../external"),g=null;if(d.nodestream)try{g=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(E,f){return new b.Promise(function(_,m){var h=[],S=E._internalType,I=E._outputType,x=E._mimeType;E.on("data",function(C,T){h.push(C),f&&f(T)}).on("error",function(C){h=[],m(C)}).on("end",function(){try{var C=(function(T,F,D){switch(T){case"blob":return s.newBlob(s.transformTo("arraybuffer",F),D);case"base64":return u.encode(F);default:return s.transformTo(T,F)}})(I,(function(T,F){var D,V=0,te=null,v=0;for(D=0;D<F.length;D++)v+=F[D].length;switch(T){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(te=new Uint8Array(v),D=0;D<F.length;D++)te.set(F[D],V),V+=F[D].length;return te;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+T+"'")}})(S,h),x);_(C)}catch(T){m(T)}h=[]}).resume()})}function p(E,f,_){var m=f;switch(f){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=f,this._mimeType=_,s.checkSupport(m),this._worker=E.pipe(new a(m)),E.lock()}catch(h){this._worker=new o("error"),this._worker.error(h)}}p.prototype={accumulate:function(E){return w(this,E)},on:function(E,f){var _=this;return E==="data"?this._worker.on(E,function(m){f.call(_,m.data,m.meta)}):this._worker.on(E,function(){s.delay(f,arguments,_)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(E){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},E)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var s=n("./utils"),a=n("./support"),o=n("./nodejsUtils"),u=n("./stream/GenericWorker"),d=new Array(256),b=0;b<256;b++)d[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;d[254]=d[254]=1;function g(){u.call(this,"utf-8 decode"),this.leftOver=null}function w(){u.call(this,"utf-8 encode")}i.utf8encode=function(p){return a.nodebuffer?o.newBufferFrom(p,"utf-8"):(function(E){var f,_,m,h,S,I=E.length,x=0;for(h=0;h<I;h++)(64512&(_=E.charCodeAt(h)))==55296&&h+1<I&&(64512&(m=E.charCodeAt(h+1)))==56320&&(_=65536+(_-55296<<10)+(m-56320),h++),x+=_<128?1:_<2048?2:_<65536?3:4;for(f=a.uint8array?new Uint8Array(x):new Array(x),h=S=0;S<x;h++)(64512&(_=E.charCodeAt(h)))==55296&&h+1<I&&(64512&(m=E.charCodeAt(h+1)))==56320&&(_=65536+(_-55296<<10)+(m-56320),h++),_<128?f[S++]=_:(_<2048?f[S++]=192|_>>>6:(_<65536?f[S++]=224|_>>>12:(f[S++]=240|_>>>18,f[S++]=128|_>>>12&63),f[S++]=128|_>>>6&63),f[S++]=128|63&_);return f})(p)},i.utf8decode=function(p){return a.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(E){var f,_,m,h,S=E.length,I=new Array(2*S);for(f=_=0;f<S;)if((m=E[f++])<128)I[_++]=m;else if(4<(h=d[m]))I[_++]=65533,f+=h-1;else{for(m&=h===2?31:h===3?15:7;1<h&&f<S;)m=m<<6|63&E[f++],h--;1<h?I[_++]=65533:m<65536?I[_++]=m:(m-=65536,I[_++]=55296|m>>10&1023,I[_++]=56320|1023&m)}return I.length!==_&&(I.subarray?I=I.subarray(0,_):I.length=_),s.applyFromCharCode(I)})(p=s.transformTo(a.uint8array?"uint8array":"array",p))},s.inherits(g,u),g.prototype.processChunk=function(p){var E=s.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var f=E;(E=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),E.set(f,this.leftOver.length)}else E=this.leftOver.concat(E);this.leftOver=null}var _=(function(h,S){var I;for((S=S||h.length)>h.length&&(S=h.length),I=S-1;0<=I&&(192&h[I])==128;)I--;return I<0||I===0?S:I+d[h[I]]>S?I:S})(E),m=E;_!==E.length&&(a.uint8array?(m=E.subarray(0,_),this.leftOver=E.subarray(_,E.length)):(m=E.slice(0,_),this.leftOver=E.slice(_,E.length))),this.push({data:i.utf8decode(m),meta:p.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=g,s.inherits(w,u),w.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var s=n("./support"),a=n("./base64"),o=n("./nodejsUtils"),u=n("./external");function d(f){return f}function b(f,_){for(var m=0;m<f.length;++m)_[m]=255&f.charCodeAt(m);return _}n("setimmediate"),i.newBlob=function(f,_){i.checkSupport("blob");try{return new Blob([f],{type:_})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(f),m.getBlob(_)}catch{throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(f,_,m){var h=[],S=0,I=f.length;if(I<=m)return String.fromCharCode.apply(null,f);for(;S<I;)_==="array"||_==="nodebuffer"?h.push(String.fromCharCode.apply(null,f.slice(S,Math.min(S+m,I)))):h.push(String.fromCharCode.apply(null,f.subarray(S,Math.min(S+m,I)))),S+=m;return h.join("")},stringifyByChar:function(f){for(var _="",m=0;m<f.length;m++)_+=String.fromCharCode(f[m]);return _},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function w(f){var _=65536,m=i.getTypeOf(f),h=!0;if(m==="uint8array"?h=g.applyCanBeUsed.uint8array:m==="nodebuffer"&&(h=g.applyCanBeUsed.nodebuffer),h)for(;1<_;)try{return g.stringifyByChunk(f,m,_)}catch{_=Math.floor(_/2)}return g.stringifyByChar(f)}function p(f,_){for(var m=0;m<f.length;m++)_[m]=f[m];return _}i.applyFromCharCode=w;var E={};E.string={string:d,array:function(f){return b(f,new Array(f.length))},arraybuffer:function(f){return E.string.uint8array(f).buffer},uint8array:function(f){return b(f,new Uint8Array(f.length))},nodebuffer:function(f){return b(f,o.allocBuffer(f.length))}},E.array={string:w,array:d,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(f)}},E.arraybuffer={string:function(f){return w(new Uint8Array(f))},array:function(f){return p(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:d,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(new Uint8Array(f))}},E.uint8array={string:w,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:d,nodebuffer:function(f){return o.newBufferFrom(f)}},E.nodebuffer={string:w,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return E.nodebuffer.uint8array(f).buffer},uint8array:function(f){return p(f,new Uint8Array(f.length))},nodebuffer:d},i.transformTo=function(f,_){if(_=_||"",!f)return _;i.checkSupport(f);var m=i.getTypeOf(_);return E[m][f](_)},i.resolve=function(f){for(var _=f.split("/"),m=[],h=0;h<_.length;h++){var S=_[h];S==="."||S===""&&h!==0&&h!==_.length-1||(S===".."?m.pop():m.push(S))}return m.join("/")},i.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":s.nodebuffer&&o.isBuffer(f)?"nodebuffer":s.uint8array&&f instanceof Uint8Array?"uint8array":s.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(f){if(!s[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(f){var _,m,h="";for(m=0;m<(f||"").length;m++)h+="\\x"+((_=f.charCodeAt(m))<16?"0":"")+_.toString(16).toUpperCase();return h},i.delay=function(f,_,m){setImmediate(function(){f.apply(m||null,_||[])})},i.inherits=function(f,_){function m(){}m.prototype=_.prototype,f.prototype=new m},i.extend=function(){var f,_,m={};for(f=0;f<arguments.length;f++)for(_ in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],_)&&m[_]===void 0&&(m[_]=arguments[f][_]);return m},i.prepareContent=function(f,_,m,h,S){return u.Promise.resolve(_).then(function(I){return s.blob&&(I instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(I))!==-1)&&typeof FileReader<"u"?new u.Promise(function(x,C){var T=new FileReader;T.onload=function(F){x(F.target.result)},T.onerror=function(F){C(F.target.error)},T.readAsArrayBuffer(I)}):I}).then(function(I){var x=i.getTypeOf(I);return x?(x==="arraybuffer"?I=i.transformTo("uint8array",I):x==="string"&&(S?I=a.decode(I):m&&h!==!0&&(I=(function(C){return b(C,s.uint8array?new Uint8Array(C.length):new Array(C.length))})(I))),I):u.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,i){var s=n("./reader/readerFor"),a=n("./utils"),o=n("./signature"),u=n("./zipEntry"),d=n("./support");function b(g){this.files=[],this.loadOptions=g}b.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var w=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(w)+", expected "+a.pretty(g)+")")}},isSignature:function(g,w){var p=this.reader.index;this.reader.setIndex(g);var E=this.reader.readString(4)===w;return this.reader.setIndex(p),E},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var g=this.reader.readData(this.zipCommentLength),w=d.uint8array?"uint8array":"array",p=a.transformTo(w,g);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var g,w,p,E=this.zip64EndOfCentralSize-44;0<E;)g=this.reader.readInt(2),w=this.reader.readInt(4),p=this.reader.readData(w),this.zip64ExtensibleData[g]={id:g,length:w,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var g,w;for(g=0;g<this.files.length;g++)w=this.files[g],this.reader.setIndex(w.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),w.readLocalPart(this.reader),w.handleUTF8(),w.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(g=new u({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(g);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var g=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(g);var w=g;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var E=w-p;if(0<E)this.isSignature(w,o.CENTRAL_FILE_HEADER)||(this.reader.zero=E);else if(E<0)throw new Error("Corrupted zip: missing "+Math.abs(E)+" bytes.")},prepareReader:function(g){this.reader=s(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=b},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var s=n("./reader/readerFor"),a=n("./utils"),o=n("./compressedObject"),u=n("./crc32"),d=n("./utf8"),b=n("./compressions"),g=n("./support");function w(p,E){this.options=p,this.loadOptions=E}w.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var E,f;if(p.skip(22),this.fileNameLength=p.readInt(2),f=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(f),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((E=(function(_){for(var m in b)if(Object.prototype.hasOwnProperty.call(b,m)&&b[m].magic===_)return b[m];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,E,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var E=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(E),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var E,f,_,m=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<m;)E=p.readInt(2),f=p.readInt(2),_=p.readData(f),this.extraFields[E]={id:E,length:f,value:_};p.setIndex(m)},handleUTF8:function(){var p=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var E=this.findExtraFieldUnicodePath();if(E!==null)this.fileNameStr=E;else{var f=a.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var m=a.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var E=s(p.value);return E.readInt(1)!==1||u(this.fileName)!==E.readInt(4)?null:d.utf8decode(E.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var E=s(p.value);return E.readInt(1)!==1||u(this.fileComment)!==E.readInt(4)?null:d.utf8decode(E.readData(p.length-5))}return null}},r.exports=w},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,i){function s(E,f,_){this.name=E,this.dir=_.dir,this.date=_.date,this.comment=_.comment,this.unixPermissions=_.unixPermissions,this.dosPermissions=_.dosPermissions,this._data=f,this._dataBinary=_.binary,this.options={compression:_.compression,compressionOptions:_.compressionOptions}}var a=n("./stream/StreamHelper"),o=n("./stream/DataWorker"),u=n("./utf8"),d=n("./compressedObject"),b=n("./stream/GenericWorker");s.prototype={internalStream:function(E){var f=null,_="string";try{if(!E)throw new Error("No output type specified.");var m=(_=E.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),f=this._decompressWorker();var h=!this._dataBinary;h&&!m&&(f=f.pipe(new u.Utf8EncodeWorker)),!h&&m&&(f=f.pipe(new u.Utf8DecodeWorker))}catch(S){(f=new b("error")).error(S)}return new a(f,_,"")},async:function(E,f){return this.internalStream(E).accumulate(f)},nodeStream:function(E,f){return this.internalStream(E||"nodebuffer").toNodejsStream(f)},_compressWorker:function(E,f){if(this._data instanceof d&&this._data.compression.magic===E.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new u.Utf8EncodeWorker)),d.createWorkerFrom(_,E,f)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof b?this._data:new o(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],w=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<g.length;p++)s.prototype[g[p]]=w;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(s){var a,o,u=s.MutationObserver||s.WebKitMutationObserver;if(u){var d=0,b=new u(E),g=s.document.createTextNode("");b.observe(g,{characterData:!0}),a=function(){g.data=d=++d%2}}else if(s.setImmediate||s.MessageChannel===void 0)a="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var f=s.document.createElement("script");f.onreadystatechange=function(){E(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},s.document.documentElement.appendChild(f)}:function(){setTimeout(E,0)};else{var w=new s.MessageChannel;w.port1.onmessage=E,a=function(){w.port2.postMessage(0)}}var p=[];function E(){var f,_;o=!0;for(var m=p.length;m;){for(_=p,p=[],f=-1;++f<m;)_[f]();m=p.length}o=!1}r.exports=function(f){p.push(f)!==1||o||a()}}).call(this,typeof st<"u"?st:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var s=n("immediate");function a(){}var o={},u=["REJECTED"],d=["FULFILLED"],b=["PENDING"];function g(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,m!==a&&f(this,m)}function w(m,h,S){this.promise=m,typeof h=="function"&&(this.onFulfilled=h,this.callFulfilled=this.otherCallFulfilled),typeof S=="function"&&(this.onRejected=S,this.callRejected=this.otherCallRejected)}function p(m,h,S){s(function(){var I;try{I=h(S)}catch(x){return o.reject(m,x)}I===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,I)})}function E(m){var h=m&&m.then;if(m&&(typeof m=="object"||typeof m=="function")&&typeof h=="function")return function(){h.apply(m,arguments)}}function f(m,h){var S=!1;function I(T){S||(S=!0,o.reject(m,T))}function x(T){S||(S=!0,o.resolve(m,T))}var C=_(function(){h(x,I)});C.status==="error"&&I(C.value)}function _(m,h){var S={};try{S.value=m(h),S.status="success"}catch(I){S.status="error",S.value=I}return S}(r.exports=g).prototype.finally=function(m){if(typeof m!="function")return this;var h=this.constructor;return this.then(function(S){return h.resolve(m()).then(function(){return S})},function(S){return h.resolve(m()).then(function(){throw S})})},g.prototype.catch=function(m){return this.then(null,m)},g.prototype.then=function(m,h){if(typeof m!="function"&&this.state===d||typeof h!="function"&&this.state===u)return this;var S=new this.constructor(a);return this.state!==b?p(S,this.state===d?m:h,this.outcome):this.queue.push(new w(S,m,h)),S},w.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},w.prototype.otherCallFulfilled=function(m){p(this.promise,this.onFulfilled,m)},w.prototype.callRejected=function(m){o.reject(this.promise,m)},w.prototype.otherCallRejected=function(m){p(this.promise,this.onRejected,m)},o.resolve=function(m,h){var S=_(E,h);if(S.status==="error")return o.reject(m,S.value);var I=S.value;if(I)f(m,I);else{m.state=d,m.outcome=h;for(var x=-1,C=m.queue.length;++x<C;)m.queue[x].callFulfilled(h)}return m},o.reject=function(m,h){m.state=u,m.outcome=h;for(var S=-1,I=m.queue.length;++S<I;)m.queue[S].callRejected(h);return m},g.resolve=function(m){return m instanceof this?m:o.resolve(new this(a),m)},g.reject=function(m){var h=new this(a);return o.reject(h,m)},g.all=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var S=m.length,I=!1;if(!S)return this.resolve([]);for(var x=new Array(S),C=0,T=-1,F=new this(a);++T<S;)D(m[T],T);return F;function D(V,te){h.resolve(V).then(function(v){x[te]=v,++C!==S||I||(I=!0,o.resolve(F,x))},function(v){I||(I=!0,o.reject(F,v))})}},g.race=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var S=m.length,I=!1;if(!S)return this.resolve([]);for(var x=-1,C=new this(a);++x<S;)T=m[x],h.resolve(T).then(function(F){I||(I=!0,o.resolve(C,F))},function(F){I||(I=!0,o.reject(C,F))});var T;return C}},{immediate:36}],38:[function(n,r,i){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,i){var s=n("./zlib/deflate"),a=n("./utils/common"),o=n("./utils/strings"),u=n("./zlib/messages"),d=n("./zlib/zstream"),b=Object.prototype.toString,g=0,w=-1,p=0,E=8;function f(m){if(!(this instanceof f))return new f(m);this.options=a.assign({level:w,method:E,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},m||{});var h=this.options;h.raw&&0<h.windowBits?h.windowBits=-h.windowBits:h.gzip&&0<h.windowBits&&h.windowBits<16&&(h.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var S=s.deflateInit2(this.strm,h.level,h.method,h.windowBits,h.memLevel,h.strategy);if(S!==g)throw new Error(u[S]);if(h.header&&s.deflateSetHeader(this.strm,h.header),h.dictionary){var I;if(I=typeof h.dictionary=="string"?o.string2buf(h.dictionary):b.call(h.dictionary)==="[object ArrayBuffer]"?new Uint8Array(h.dictionary):h.dictionary,(S=s.deflateSetDictionary(this.strm,I))!==g)throw new Error(u[S]);this._dict_set=!0}}function _(m,h){var S=new f(h);if(S.push(m,!0),S.err)throw S.msg||u[S.err];return S.result}f.prototype.push=function(m,h){var S,I,x=this.strm,C=this.options.chunkSize;if(this.ended)return!1;I=h===~~h?h:h===!0?4:0,typeof m=="string"?x.input=o.string2buf(m):b.call(m)==="[object ArrayBuffer]"?x.input=new Uint8Array(m):x.input=m,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new a.Buf8(C),x.next_out=0,x.avail_out=C),(S=s.deflate(x,I))!==1&&S!==g)return this.onEnd(S),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||I!==4&&I!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(x.output,x.next_out))):this.onData(a.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&S!==1);return I===4?(S=s.deflateEnd(this.strm),this.onEnd(S),this.ended=!0,S===g):I!==2||(this.onEnd(g),!(x.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Deflate=f,i.deflate=_,i.deflateRaw=function(m,h){return(h=h||{}).raw=!0,_(m,h)},i.gzip=function(m,h){return(h=h||{}).gzip=!0,_(m,h)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,i){var s=n("./zlib/inflate"),a=n("./utils/common"),o=n("./utils/strings"),u=n("./zlib/constants"),d=n("./zlib/messages"),b=n("./zlib/zstream"),g=n("./zlib/gzheader"),w=Object.prototype.toString;function p(f){if(!(this instanceof p))return new p(f);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},f||{});var _=this.options;_.raw&&0<=_.windowBits&&_.windowBits<16&&(_.windowBits=-_.windowBits,_.windowBits===0&&(_.windowBits=-15)),!(0<=_.windowBits&&_.windowBits<16)||f&&f.windowBits||(_.windowBits+=32),15<_.windowBits&&_.windowBits<48&&(15&_.windowBits)==0&&(_.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var m=s.inflateInit2(this.strm,_.windowBits);if(m!==u.Z_OK)throw new Error(d[m]);this.header=new g,s.inflateGetHeader(this.strm,this.header)}function E(f,_){var m=new p(_);if(m.push(f,!0),m.err)throw m.msg||d[m.err];return m.result}p.prototype.push=function(f,_){var m,h,S,I,x,C,T=this.strm,F=this.options.chunkSize,D=this.options.dictionary,V=!1;if(this.ended)return!1;h=_===~~_?_:_===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof f=="string"?T.input=o.binstring2buf(f):w.call(f)==="[object ArrayBuffer]"?T.input=new Uint8Array(f):T.input=f,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new a.Buf8(F),T.next_out=0,T.avail_out=F),(m=s.inflate(T,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&D&&(C=typeof D=="string"?o.string2buf(D):w.call(D)==="[object ArrayBuffer]"?new Uint8Array(D):D,m=s.inflateSetDictionary(this.strm,C)),m===u.Z_BUF_ERROR&&V===!0&&(m=u.Z_OK,V=!1),m!==u.Z_STREAM_END&&m!==u.Z_OK)return this.onEnd(m),!(this.ended=!0);T.next_out&&(T.avail_out!==0&&m!==u.Z_STREAM_END&&(T.avail_in!==0||h!==u.Z_FINISH&&h!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(S=o.utf8border(T.output,T.next_out),I=T.next_out-S,x=o.buf2string(T.output,S),T.next_out=I,T.avail_out=F-I,I&&a.arraySet(T.output,T.output,S,I,0),this.onData(x)):this.onData(a.shrinkBuf(T.output,T.next_out)))),T.avail_in===0&&T.avail_out===0&&(V=!0)}while((0<T.avail_in||T.avail_out===0)&&m!==u.Z_STREAM_END);return m===u.Z_STREAM_END&&(h=u.Z_FINISH),h===u.Z_FINISH?(m=s.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===u.Z_OK):h!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(T.avail_out=0))},p.prototype.onData=function(f){this.chunks.push(f)},p.prototype.onEnd=function(f){f===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},i.Inflate=p,i.inflate=E,i.inflateRaw=function(f,_){return(_=_||{}).raw=!0,E(f,_)},i.ungzip=E},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(u){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var b=d.shift();if(b){if(typeof b!="object")throw new TypeError(b+"must be non-object");for(var g in b)b.hasOwnProperty(g)&&(u[g]=b[g])}}return u},i.shrinkBuf=function(u,d){return u.length===d?u:u.subarray?u.subarray(0,d):(u.length=d,u)};var a={arraySet:function(u,d,b,g,w){if(d.subarray&&u.subarray)u.set(d.subarray(b,b+g),w);else for(var p=0;p<g;p++)u[w+p]=d[b+p]},flattenChunks:function(u){var d,b,g,w,p,E;for(d=g=0,b=u.length;d<b;d++)g+=u[d].length;for(E=new Uint8Array(g),d=w=0,b=u.length;d<b;d++)p=u[d],E.set(p,w),w+=p.length;return E}},o={arraySet:function(u,d,b,g,w){for(var p=0;p<g;p++)u[w+p]=d[b+p]},flattenChunks:function(u){return[].concat.apply([],u)}};i.setTyped=function(u){u?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,a)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(s)},{}],42:[function(n,r,i){var s=n("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var u=new s.Buf8(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function b(g,w){if(w<65537&&(g.subarray&&o||!g.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(g,w));for(var p="",E=0;E<w;E++)p+=String.fromCharCode(g[E]);return p}u[254]=u[254]=1,i.string2buf=function(g){var w,p,E,f,_,m=g.length,h=0;for(f=0;f<m;f++)(64512&(p=g.charCodeAt(f)))==55296&&f+1<m&&(64512&(E=g.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(E-56320),f++),h+=p<128?1:p<2048?2:p<65536?3:4;for(w=new s.Buf8(h),f=_=0;_<h;f++)(64512&(p=g.charCodeAt(f)))==55296&&f+1<m&&(64512&(E=g.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(E-56320),f++),p<128?w[_++]=p:(p<2048?w[_++]=192|p>>>6:(p<65536?w[_++]=224|p>>>12:(w[_++]=240|p>>>18,w[_++]=128|p>>>12&63),w[_++]=128|p>>>6&63),w[_++]=128|63&p);return w},i.buf2binstring=function(g){return b(g,g.length)},i.binstring2buf=function(g){for(var w=new s.Buf8(g.length),p=0,E=w.length;p<E;p++)w[p]=g.charCodeAt(p);return w},i.buf2string=function(g,w){var p,E,f,_,m=w||g.length,h=new Array(2*m);for(p=E=0;p<m;)if((f=g[p++])<128)h[E++]=f;else if(4<(_=u[f]))h[E++]=65533,p+=_-1;else{for(f&=_===2?31:_===3?15:7;1<_&&p<m;)f=f<<6|63&g[p++],_--;1<_?h[E++]=65533:f<65536?h[E++]=f:(f-=65536,h[E++]=55296|f>>10&1023,h[E++]=56320|1023&f)}return b(h,E)},i.utf8border=function(g,w){var p;for((w=w||g.length)>g.length&&(w=g.length),p=w-1;0<=p&&(192&g[p])==128;)p--;return p<0||p===0?w:p+u[g[p]]>w?p:w}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,a,o,u){for(var d=65535&s|0,b=s>>>16&65535|0,g=0;o!==0;){for(o-=g=2e3<o?2e3:o;b=b+(d=d+a[u++]|0)|0,--g;);d%=65521,b%=65521}return d|b<<16|0}},{}],44:[function(n,r,i){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,i){var s=(function(){for(var a,o=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;o[u]=a}return o})();r.exports=function(a,o,u,d){var b=s,g=d+u;a^=-1;for(var w=d;w<g;w++)a=a>>>8^b[255&(a^o[w])];return-1^a}},{}],46:[function(n,r,i){var s,a=n("../utils/common"),o=n("./trees"),u=n("./adler32"),d=n("./crc32"),b=n("./messages"),g=0,w=4,p=0,E=-2,f=-1,_=4,m=2,h=8,S=9,I=286,x=30,C=19,T=2*I+1,F=15,D=3,V=258,te=V+D+1,v=42,j=113,c=1,U=2,N=3,P=4;function q(l,$){return l.msg=b[$],$}function B(l){return(l<<1)-(4<l?9:0)}function J(l){for(var $=l.length;0<=--$;)l[$]=0}function A(l){var $=l.state,z=$.pending;z>l.avail_out&&(z=l.avail_out),z!==0&&(a.arraySet(l.output,$.pending_buf,$.pending_out,z,l.next_out),l.next_out+=z,$.pending_out+=z,l.total_out+=z,l.avail_out-=z,$.pending-=z,$.pending===0&&($.pending_out=0))}function R(l,$){o._tr_flush_block(l,0<=l.block_start?l.block_start:-1,l.strstart-l.block_start,$),l.block_start=l.strstart,A(l.strm)}function Y(l,$){l.pending_buf[l.pending++]=$}function G(l,$){l.pending_buf[l.pending++]=$>>>8&255,l.pending_buf[l.pending++]=255&$}function W(l,$){var z,O,y=l.max_chain_length,k=l.strstart,H=l.prev_length,Z=l.nice_match,M=l.strstart>l.w_size-te?l.strstart-(l.w_size-te):0,X=l.window,Q=l.w_mask,K=l.prev,ne=l.strstart+V,de=X[k+H-1],ue=X[k+H];l.prev_length>=l.good_match&&(y>>=2),Z>l.lookahead&&(Z=l.lookahead);do if(X[(z=$)+H]===ue&&X[z+H-1]===de&&X[z]===X[k]&&X[++z]===X[k+1]){k+=2,z++;do;while(X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&k<ne);if(O=V-(ne-k),k=ne-V,H<O){if(l.match_start=$,Z<=(H=O))break;de=X[k+H-1],ue=X[k+H]}}while(($=K[$&Q])>M&&--y!=0);return H<=l.lookahead?H:l.lookahead}function ae(l){var $,z,O,y,k,H,Z,M,X,Q,K=l.w_size;do{if(y=l.window_size-l.lookahead-l.strstart,l.strstart>=K+(K-te)){for(a.arraySet(l.window,l.window,K,K,0),l.match_start-=K,l.strstart-=K,l.block_start-=K,$=z=l.hash_size;O=l.head[--$],l.head[$]=K<=O?O-K:0,--z;);for($=z=K;O=l.prev[--$],l.prev[$]=K<=O?O-K:0,--z;);y+=K}if(l.strm.avail_in===0)break;if(H=l.strm,Z=l.window,M=l.strstart+l.lookahead,X=y,Q=void 0,Q=H.avail_in,X<Q&&(Q=X),z=Q===0?0:(H.avail_in-=Q,a.arraySet(Z,H.input,H.next_in,Q,M),H.state.wrap===1?H.adler=u(H.adler,Z,Q,M):H.state.wrap===2&&(H.adler=d(H.adler,Z,Q,M)),H.next_in+=Q,H.total_in+=Q,Q),l.lookahead+=z,l.lookahead+l.insert>=D)for(k=l.strstart-l.insert,l.ins_h=l.window[k],l.ins_h=(l.ins_h<<l.hash_shift^l.window[k+1])&l.hash_mask;l.insert&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[k+D-1])&l.hash_mask,l.prev[k&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=k,k++,l.insert--,!(l.lookahead+l.insert<D)););}while(l.lookahead<te&&l.strm.avail_in!==0)}function ie(l,$){for(var z,O;;){if(l.lookahead<te){if(ae(l),l.lookahead<te&&$===g)return c;if(l.lookahead===0)break}if(z=0,l.lookahead>=D&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+D-1])&l.hash_mask,z=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart),z!==0&&l.strstart-z<=l.w_size-te&&(l.match_length=W(l,z)),l.match_length>=D)if(O=o._tr_tally(l,l.strstart-l.match_start,l.match_length-D),l.lookahead-=l.match_length,l.match_length<=l.max_lazy_match&&l.lookahead>=D){for(l.match_length--;l.strstart++,l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+D-1])&l.hash_mask,z=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart,--l.match_length!=0;);l.strstart++}else l.strstart+=l.match_length,l.match_length=0,l.ins_h=l.window[l.strstart],l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+1])&l.hash_mask;else O=o._tr_tally(l,0,l.window[l.strstart]),l.lookahead--,l.strstart++;if(O&&(R(l,!1),l.strm.avail_out===0))return c}return l.insert=l.strstart<D-1?l.strstart:D-1,$===w?(R(l,!0),l.strm.avail_out===0?N:P):l.last_lit&&(R(l,!1),l.strm.avail_out===0)?c:U}function re(l,$){for(var z,O,y;;){if(l.lookahead<te){if(ae(l),l.lookahead<te&&$===g)return c;if(l.lookahead===0)break}if(z=0,l.lookahead>=D&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+D-1])&l.hash_mask,z=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart),l.prev_length=l.match_length,l.prev_match=l.match_start,l.match_length=D-1,z!==0&&l.prev_length<l.max_lazy_match&&l.strstart-z<=l.w_size-te&&(l.match_length=W(l,z),l.match_length<=5&&(l.strategy===1||l.match_length===D&&4096<l.strstart-l.match_start)&&(l.match_length=D-1)),l.prev_length>=D&&l.match_length<=l.prev_length){for(y=l.strstart+l.lookahead-D,O=o._tr_tally(l,l.strstart-1-l.prev_match,l.prev_length-D),l.lookahead-=l.prev_length-1,l.prev_length-=2;++l.strstart<=y&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+D-1])&l.hash_mask,z=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart),--l.prev_length!=0;);if(l.match_available=0,l.match_length=D-1,l.strstart++,O&&(R(l,!1),l.strm.avail_out===0))return c}else if(l.match_available){if((O=o._tr_tally(l,0,l.window[l.strstart-1]))&&R(l,!1),l.strstart++,l.lookahead--,l.strm.avail_out===0)return c}else l.match_available=1,l.strstart++,l.lookahead--}return l.match_available&&(O=o._tr_tally(l,0,l.window[l.strstart-1]),l.match_available=0),l.insert=l.strstart<D-1?l.strstart:D-1,$===w?(R(l,!0),l.strm.avail_out===0?N:P):l.last_lit&&(R(l,!1),l.strm.avail_out===0)?c:U}function se(l,$,z,O,y){this.good_length=l,this.max_lazy=$,this.nice_length=z,this.max_chain=O,this.func=y}function ce(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=h,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*T),this.dyn_dtree=new a.Buf16(2*(2*x+1)),this.bl_tree=new a.Buf16(2*(2*C+1)),J(this.dyn_ltree),J(this.dyn_dtree),J(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(F+1),this.heap=new a.Buf16(2*I+1),J(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*I+1),J(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function pe(l){var $;return l&&l.state?(l.total_in=l.total_out=0,l.data_type=m,($=l.state).pending=0,$.pending_out=0,$.wrap<0&&($.wrap=-$.wrap),$.status=$.wrap?v:j,l.adler=$.wrap===2?0:1,$.last_flush=g,o._tr_init($),p):q(l,E)}function fe(l){var $=pe(l);return $===p&&(function(z){z.window_size=2*z.w_size,J(z.head),z.max_lazy_match=s[z.level].max_lazy,z.good_match=s[z.level].good_length,z.nice_match=s[z.level].nice_length,z.max_chain_length=s[z.level].max_chain,z.strstart=0,z.block_start=0,z.lookahead=0,z.insert=0,z.match_length=z.prev_length=D-1,z.match_available=0,z.ins_h=0})(l.state),$}function ge(l,$,z,O,y,k){if(!l)return E;var H=1;if($===f&&($=6),O<0?(H=0,O=-O):15<O&&(H=2,O-=16),y<1||S<y||z!==h||O<8||15<O||$<0||9<$||k<0||_<k)return q(l,E);O===8&&(O=9);var Z=new ce;return(l.state=Z).strm=l,Z.wrap=H,Z.gzhead=null,Z.w_bits=O,Z.w_size=1<<Z.w_bits,Z.w_mask=Z.w_size-1,Z.hash_bits=y+7,Z.hash_size=1<<Z.hash_bits,Z.hash_mask=Z.hash_size-1,Z.hash_shift=~~((Z.hash_bits+D-1)/D),Z.window=new a.Buf8(2*Z.w_size),Z.head=new a.Buf16(Z.hash_size),Z.prev=new a.Buf16(Z.w_size),Z.lit_bufsize=1<<y+6,Z.pending_buf_size=4*Z.lit_bufsize,Z.pending_buf=new a.Buf8(Z.pending_buf_size),Z.d_buf=1*Z.lit_bufsize,Z.l_buf=3*Z.lit_bufsize,Z.level=$,Z.strategy=k,Z.method=z,fe(l)}s=[new se(0,0,0,0,function(l,$){var z=65535;for(z>l.pending_buf_size-5&&(z=l.pending_buf_size-5);;){if(l.lookahead<=1){if(ae(l),l.lookahead===0&&$===g)return c;if(l.lookahead===0)break}l.strstart+=l.lookahead,l.lookahead=0;var O=l.block_start+z;if((l.strstart===0||l.strstart>=O)&&(l.lookahead=l.strstart-O,l.strstart=O,R(l,!1),l.strm.avail_out===0)||l.strstart-l.block_start>=l.w_size-te&&(R(l,!1),l.strm.avail_out===0))return c}return l.insert=0,$===w?(R(l,!0),l.strm.avail_out===0?N:P):(l.strstart>l.block_start&&(R(l,!1),l.strm.avail_out),c)}),new se(4,4,8,4,ie),new se(4,5,16,8,ie),new se(4,6,32,32,ie),new se(4,4,16,16,re),new se(8,16,32,32,re),new se(8,16,128,128,re),new se(8,32,128,256,re),new se(32,128,258,1024,re),new se(32,258,258,4096,re)],i.deflateInit=function(l,$){return ge(l,$,h,15,8,0)},i.deflateInit2=ge,i.deflateReset=fe,i.deflateResetKeep=pe,i.deflateSetHeader=function(l,$){return l&&l.state?l.state.wrap!==2?E:(l.state.gzhead=$,p):E},i.deflate=function(l,$){var z,O,y,k;if(!l||!l.state||5<$||$<0)return l?q(l,E):E;if(O=l.state,!l.output||!l.input&&l.avail_in!==0||O.status===666&&$!==w)return q(l,l.avail_out===0?-5:E);if(O.strm=l,z=O.last_flush,O.last_flush=$,O.status===v)if(O.wrap===2)l.adler=0,Y(O,31),Y(O,139),Y(O,8),O.gzhead?(Y(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),Y(O,255&O.gzhead.time),Y(O,O.gzhead.time>>8&255),Y(O,O.gzhead.time>>16&255),Y(O,O.gzhead.time>>24&255),Y(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),Y(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(Y(O,255&O.gzhead.extra.length),Y(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(l.adler=d(l.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(Y(O,0),Y(O,0),Y(O,0),Y(O,0),Y(O,0),Y(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),Y(O,3),O.status=j);else{var H=h+(O.w_bits-8<<4)<<8;H|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(H|=32),H+=31-H%31,O.status=j,G(O,H),O.strstart!==0&&(G(O,l.adler>>>16),G(O,65535&l.adler)),l.adler=1}if(O.status===69)if(O.gzhead.extra){for(y=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>y&&(l.adler=d(l.adler,O.pending_buf,O.pending-y,y)),A(l),y=O.pending,O.pending!==O.pending_buf_size));)Y(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>y&&(l.adler=d(l.adler,O.pending_buf,O.pending-y,y)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){y=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>y&&(l.adler=d(l.adler,O.pending_buf,O.pending-y,y)),A(l),y=O.pending,O.pending===O.pending_buf_size)){k=1;break}k=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,Y(O,k)}while(k!==0);O.gzhead.hcrc&&O.pending>y&&(l.adler=d(l.adler,O.pending_buf,O.pending-y,y)),k===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){y=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>y&&(l.adler=d(l.adler,O.pending_buf,O.pending-y,y)),A(l),y=O.pending,O.pending===O.pending_buf_size)){k=1;break}k=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,Y(O,k)}while(k!==0);O.gzhead.hcrc&&O.pending>y&&(l.adler=d(l.adler,O.pending_buf,O.pending-y,y)),k===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&A(l),O.pending+2<=O.pending_buf_size&&(Y(O,255&l.adler),Y(O,l.adler>>8&255),l.adler=0,O.status=j)):O.status=j),O.pending!==0){if(A(l),l.avail_out===0)return O.last_flush=-1,p}else if(l.avail_in===0&&B($)<=B(z)&&$!==w)return q(l,-5);if(O.status===666&&l.avail_in!==0)return q(l,-5);if(l.avail_in!==0||O.lookahead!==0||$!==g&&O.status!==666){var Z=O.strategy===2?(function(M,X){for(var Q;;){if(M.lookahead===0&&(ae(M),M.lookahead===0)){if(X===g)return c;break}if(M.match_length=0,Q=o._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,Q&&(R(M,!1),M.strm.avail_out===0))return c}return M.insert=0,X===w?(R(M,!0),M.strm.avail_out===0?N:P):M.last_lit&&(R(M,!1),M.strm.avail_out===0)?c:U})(O,$):O.strategy===3?(function(M,X){for(var Q,K,ne,de,ue=M.window;;){if(M.lookahead<=V){if(ae(M),M.lookahead<=V&&X===g)return c;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=D&&0<M.strstart&&(K=ue[ne=M.strstart-1])===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]){de=M.strstart+V;do;while(K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&ne<de);M.match_length=V-(de-ne),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=D?(Q=o._tr_tally(M,1,M.match_length-D),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(Q=o._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),Q&&(R(M,!1),M.strm.avail_out===0))return c}return M.insert=0,X===w?(R(M,!0),M.strm.avail_out===0?N:P):M.last_lit&&(R(M,!1),M.strm.avail_out===0)?c:U})(O,$):s[O.level].func(O,$);if(Z!==N&&Z!==P||(O.status=666),Z===c||Z===N)return l.avail_out===0&&(O.last_flush=-1),p;if(Z===U&&($===1?o._tr_align(O):$!==5&&(o._tr_stored_block(O,0,0,!1),$===3&&(J(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),A(l),l.avail_out===0))return O.last_flush=-1,p}return $!==w?p:O.wrap<=0?1:(O.wrap===2?(Y(O,255&l.adler),Y(O,l.adler>>8&255),Y(O,l.adler>>16&255),Y(O,l.adler>>24&255),Y(O,255&l.total_in),Y(O,l.total_in>>8&255),Y(O,l.total_in>>16&255),Y(O,l.total_in>>24&255)):(G(O,l.adler>>>16),G(O,65535&l.adler)),A(l),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},i.deflateEnd=function(l){var $;return l&&l.state?($=l.state.status)!==v&&$!==69&&$!==73&&$!==91&&$!==103&&$!==j&&$!==666?q(l,E):(l.state=null,$===j?q(l,-3):p):E},i.deflateSetDictionary=function(l,$){var z,O,y,k,H,Z,M,X,Q=$.length;if(!l||!l.state||(k=(z=l.state).wrap)===2||k===1&&z.status!==v||z.lookahead)return E;for(k===1&&(l.adler=u(l.adler,$,Q,0)),z.wrap=0,Q>=z.w_size&&(k===0&&(J(z.head),z.strstart=0,z.block_start=0,z.insert=0),X=new a.Buf8(z.w_size),a.arraySet(X,$,Q-z.w_size,z.w_size,0),$=X,Q=z.w_size),H=l.avail_in,Z=l.next_in,M=l.input,l.avail_in=Q,l.next_in=0,l.input=$,ae(z);z.lookahead>=D;){for(O=z.strstart,y=z.lookahead-(D-1);z.ins_h=(z.ins_h<<z.hash_shift^z.window[O+D-1])&z.hash_mask,z.prev[O&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=O,O++,--y;);z.strstart=O,z.lookahead=D-1,ae(z)}return z.strstart+=z.lookahead,z.block_start=z.strstart,z.insert=z.lookahead,z.lookahead=0,z.match_length=z.prev_length=D-1,z.match_available=0,l.next_in=Z,l.input=M,l.avail_in=H,z.wrap=k,p},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,i){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,i){r.exports=function(s,a){var o,u,d,b,g,w,p,E,f,_,m,h,S,I,x,C,T,F,D,V,te,v,j,c,U;o=s.state,u=s.next_in,c=s.input,d=u+(s.avail_in-5),b=s.next_out,U=s.output,g=b-(a-s.avail_out),w=b+(s.avail_out-257),p=o.dmax,E=o.wsize,f=o.whave,_=o.wnext,m=o.window,h=o.hold,S=o.bits,I=o.lencode,x=o.distcode,C=(1<<o.lenbits)-1,T=(1<<o.distbits)-1;e:do{S<15&&(h+=c[u++]<<S,S+=8,h+=c[u++]<<S,S+=8),F=I[h&C];t:for(;;){if(h>>>=D=F>>>24,S-=D,(D=F>>>16&255)===0)U[b++]=65535&F;else{if(!(16&D)){if((64&D)==0){F=I[(65535&F)+(h&(1<<D)-1)];continue t}if(32&D){o.mode=12;break e}s.msg="invalid literal/length code",o.mode=30;break e}V=65535&F,(D&=15)&&(S<D&&(h+=c[u++]<<S,S+=8),V+=h&(1<<D)-1,h>>>=D,S-=D),S<15&&(h+=c[u++]<<S,S+=8,h+=c[u++]<<S,S+=8),F=x[h&T];n:for(;;){if(h>>>=D=F>>>24,S-=D,!(16&(D=F>>>16&255))){if((64&D)==0){F=x[(65535&F)+(h&(1<<D)-1)];continue n}s.msg="invalid distance code",o.mode=30;break e}if(te=65535&F,S<(D&=15)&&(h+=c[u++]<<S,(S+=8)<D&&(h+=c[u++]<<S,S+=8)),p<(te+=h&(1<<D)-1)){s.msg="invalid distance too far back",o.mode=30;break e}if(h>>>=D,S-=D,(D=b-g)<te){if(f<(D=te-D)&&o.sane){s.msg="invalid distance too far back",o.mode=30;break e}if(j=m,(v=0)===_){if(v+=E-D,D<V){for(V-=D;U[b++]=m[v++],--D;);v=b-te,j=U}}else if(_<D){if(v+=E+_-D,(D-=_)<V){for(V-=D;U[b++]=m[v++],--D;);if(v=0,_<V){for(V-=D=_;U[b++]=m[v++],--D;);v=b-te,j=U}}}else if(v+=_-D,D<V){for(V-=D;U[b++]=m[v++],--D;);v=b-te,j=U}for(;2<V;)U[b++]=j[v++],U[b++]=j[v++],U[b++]=j[v++],V-=3;V&&(U[b++]=j[v++],1<V&&(U[b++]=j[v++]))}else{for(v=b-te;U[b++]=U[v++],U[b++]=U[v++],U[b++]=U[v++],2<(V-=3););V&&(U[b++]=U[v++],1<V&&(U[b++]=U[v++]))}break}}break}}while(u<d&&b<w);u-=V=S>>3,h&=(1<<(S-=V<<3))-1,s.next_in=u,s.next_out=b,s.avail_in=u<d?d-u+5:5-(u-d),s.avail_out=b<w?w-b+257:257-(b-w),o.hold=h,o.bits=S}},{}],49:[function(n,r,i){var s=n("../utils/common"),a=n("./adler32"),o=n("./crc32"),u=n("./inffast"),d=n("./inftrees"),b=1,g=2,w=0,p=-2,E=1,f=852,_=592;function m(v){return(v>>>24&255)+(v>>>8&65280)+((65280&v)<<8)+((255&v)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(v){var j;return v&&v.state?(j=v.state,v.total_in=v.total_out=j.total=0,v.msg="",j.wrap&&(v.adler=1&j.wrap),j.mode=E,j.last=0,j.havedict=0,j.dmax=32768,j.head=null,j.hold=0,j.bits=0,j.lencode=j.lendyn=new s.Buf32(f),j.distcode=j.distdyn=new s.Buf32(_),j.sane=1,j.back=-1,w):p}function I(v){var j;return v&&v.state?((j=v.state).wsize=0,j.whave=0,j.wnext=0,S(v)):p}function x(v,j){var c,U;return v&&v.state?(U=v.state,j<0?(c=0,j=-j):(c=1+(j>>4),j<48&&(j&=15)),j&&(j<8||15<j)?p:(U.window!==null&&U.wbits!==j&&(U.window=null),U.wrap=c,U.wbits=j,I(v))):p}function C(v,j){var c,U;return v?(U=new h,(v.state=U).window=null,(c=x(v,j))!==w&&(v.state=null),c):p}var T,F,D=!0;function V(v){if(D){var j;for(T=new s.Buf32(512),F=new s.Buf32(32),j=0;j<144;)v.lens[j++]=8;for(;j<256;)v.lens[j++]=9;for(;j<280;)v.lens[j++]=7;for(;j<288;)v.lens[j++]=8;for(d(b,v.lens,0,288,T,0,v.work,{bits:9}),j=0;j<32;)v.lens[j++]=5;d(g,v.lens,0,32,F,0,v.work,{bits:5}),D=!1}v.lencode=T,v.lenbits=9,v.distcode=F,v.distbits=5}function te(v,j,c,U){var N,P=v.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new s.Buf8(P.wsize)),U>=P.wsize?(s.arraySet(P.window,j,c-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(U<(N=P.wsize-P.wnext)&&(N=U),s.arraySet(P.window,j,c-U,N,P.wnext),(U-=N)?(s.arraySet(P.window,j,c-U,U,0),P.wnext=U,P.whave=P.wsize):(P.wnext+=N,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=N))),0}i.inflateReset=I,i.inflateReset2=x,i.inflateResetKeep=S,i.inflateInit=function(v){return C(v,15)},i.inflateInit2=C,i.inflate=function(v,j){var c,U,N,P,q,B,J,A,R,Y,G,W,ae,ie,re,se,ce,pe,fe,ge,l,$,z,O,y=0,k=new s.Buf8(4),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!v||!v.state||!v.output||!v.input&&v.avail_in!==0)return p;(c=v.state).mode===12&&(c.mode=13),q=v.next_out,N=v.output,J=v.avail_out,P=v.next_in,U=v.input,B=v.avail_in,A=c.hold,R=c.bits,Y=B,G=J,$=w;e:for(;;)switch(c.mode){case E:if(c.wrap===0){c.mode=13;break}for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(2&c.wrap&&A===35615){k[c.check=0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0),R=A=0,c.mode=2;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&A)<<8)+(A>>8))%31){v.msg="incorrect header check",c.mode=30;break}if((15&A)!=8){v.msg="unknown compression method",c.mode=30;break}if(R-=4,l=8+(15&(A>>>=4)),c.wbits===0)c.wbits=l;else if(l>c.wbits){v.msg="invalid window size",c.mode=30;break}c.dmax=1<<l,v.adler=c.check=1,c.mode=512&A?10:12,R=A=0;break;case 2:for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(c.flags=A,(255&c.flags)!=8){v.msg="unknown compression method",c.mode=30;break}if(57344&c.flags){v.msg="unknown header flags set",c.mode=30;break}c.head&&(c.head.text=A>>8&1),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0,c.mode=3;case 3:for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.head&&(c.head.time=A),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,k[2]=A>>>16&255,k[3]=A>>>24&255,c.check=o(c.check,k,4,0)),R=A=0,c.mode=4;case 4:for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.head&&(c.head.xflags=255&A,c.head.os=A>>8),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0,c.mode=5;case 5:if(1024&c.flags){for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.length=A,c.head&&(c.head.extra_len=A),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(1024&c.flags&&(B<(W=c.length)&&(W=B),W&&(c.head&&(l=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,U,P,W,l)),512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,c.length-=W),c.length))break e;c.length=0,c.mode=7;case 7:if(2048&c.flags){if(B===0)break e;for(W=0;l=U[P+W++],c.head&&l&&c.length<65536&&(c.head.name+=String.fromCharCode(l)),l&&W<B;);if(512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,l)break e}else c.head&&(c.head.name=null);c.length=0,c.mode=8;case 8:if(4096&c.flags){if(B===0)break e;for(W=0;l=U[P+W++],c.head&&l&&c.length<65536&&(c.head.comment+=String.fromCharCode(l)),l&&W<B;);if(512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,l)break e}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(512&c.flags){for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A!==(65535&c.check)){v.msg="header crc mismatch",c.mode=30;break}R=A=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),v.adler=c.check=0,c.mode=12;break;case 10:for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}v.adler=c.check=m(A),R=A=0,c.mode=11;case 11:if(c.havedict===0)return v.next_out=q,v.avail_out=J,v.next_in=P,v.avail_in=B,c.hold=A,c.bits=R,2;v.adler=c.check=1,c.mode=12;case 12:if(j===5||j===6)break e;case 13:if(c.last){A>>>=7&R,R-=7&R,c.mode=27;break}for(;R<3;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}switch(c.last=1&A,R-=1,3&(A>>>=1)){case 0:c.mode=14;break;case 1:if(V(c),c.mode=20,j!==6)break;A>>>=2,R-=2;break e;case 2:c.mode=17;break;case 3:v.msg="invalid block type",c.mode=30}A>>>=2,R-=2;break;case 14:for(A>>>=7&R,R-=7&R;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if((65535&A)!=(A>>>16^65535)){v.msg="invalid stored block lengths",c.mode=30;break}if(c.length=65535&A,R=A=0,c.mode=15,j===6)break e;case 15:c.mode=16;case 16:if(W=c.length){if(B<W&&(W=B),J<W&&(W=J),W===0)break e;s.arraySet(N,U,P,W,q),B-=W,P+=W,J-=W,q+=W,c.length-=W;break}c.mode=12;break;case 17:for(;R<14;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(c.nlen=257+(31&A),A>>>=5,R-=5,c.ndist=1+(31&A),A>>>=5,R-=5,c.ncode=4+(15&A),A>>>=4,R-=4,286<c.nlen||30<c.ndist){v.msg="too many length or distance symbols",c.mode=30;break}c.have=0,c.mode=18;case 18:for(;c.have<c.ncode;){for(;R<3;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.lens[H[c.have++]]=7&A,A>>>=3,R-=3}for(;c.have<19;)c.lens[H[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,z={bits:c.lenbits},$=d(0,c.lens,0,19,c.lencode,0,c.work,z),c.lenbits=z.bits,$){v.msg="invalid code lengths set",c.mode=30;break}c.have=0,c.mode=19;case 19:for(;c.have<c.nlen+c.ndist;){for(;se=(y=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(ce<16)A>>>=re,R-=re,c.lens[c.have++]=ce;else{if(ce===16){for(O=re+2;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A>>>=re,R-=re,c.have===0){v.msg="invalid bit length repeat",c.mode=30;break}l=c.lens[c.have-1],W=3+(3&A),A>>>=2,R-=2}else if(ce===17){for(O=re+3;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}R-=re,l=0,W=3+(7&(A>>>=re)),A>>>=3,R-=3}else{for(O=re+7;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}R-=re,l=0,W=11+(127&(A>>>=re)),A>>>=7,R-=7}if(c.have+W>c.nlen+c.ndist){v.msg="invalid bit length repeat",c.mode=30;break}for(;W--;)c.lens[c.have++]=l}}if(c.mode===30)break;if(c.lens[256]===0){v.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,z={bits:c.lenbits},$=d(b,c.lens,0,c.nlen,c.lencode,0,c.work,z),c.lenbits=z.bits,$){v.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,z={bits:c.distbits},$=d(g,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,z),c.distbits=z.bits,$){v.msg="invalid distances set",c.mode=30;break}if(c.mode=20,j===6)break e;case 20:c.mode=21;case 21:if(6<=B&&258<=J){v.next_out=q,v.avail_out=J,v.next_in=P,v.avail_in=B,c.hold=A,c.bits=R,u(v,G),q=v.next_out,N=v.output,J=v.avail_out,P=v.next_in,U=v.input,B=v.avail_in,A=c.hold,R=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;se=(y=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(se&&(240&se)==0){for(pe=re,fe=se,ge=ce;se=(y=c.lencode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&y,!(pe+(re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,c.length=ce,se===0){c.mode=26;break}if(32&se){c.back=-1,c.mode=12;break}if(64&se){v.msg="invalid literal/length code",c.mode=30;break}c.extra=15&se,c.mode=22;case 22:if(c.extra){for(O=c.extra;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.length+=A&(1<<c.extra)-1,A>>>=c.extra,R-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=23;case 23:for(;se=(y=c.distcode[A&(1<<c.distbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if((240&se)==0){for(pe=re,fe=se,ge=ce;se=(y=c.distcode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&y,!(pe+(re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,64&se){v.msg="invalid distance code",c.mode=30;break}c.offset=ce,c.extra=15&se,c.mode=24;case 24:if(c.extra){for(O=c.extra;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.offset+=A&(1<<c.extra)-1,A>>>=c.extra,R-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){v.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(J===0)break e;if(W=G-J,c.offset>W){if((W=c.offset-W)>c.whave&&c.sane){v.msg="invalid distance too far back",c.mode=30;break}ae=W>c.wnext?(W-=c.wnext,c.wsize-W):c.wnext-W,W>c.length&&(W=c.length),ie=c.window}else ie=N,ae=q-c.offset,W=c.length;for(J<W&&(W=J),J-=W,c.length-=W;N[q++]=ie[ae++],--W;);c.length===0&&(c.mode=21);break;case 26:if(J===0)break e;N[q++]=c.length,J--,c.mode=21;break;case 27:if(c.wrap){for(;R<32;){if(B===0)break e;B--,A|=U[P++]<<R,R+=8}if(G-=J,v.total_out+=G,c.total+=G,G&&(v.adler=c.check=c.flags?o(c.check,N,G,q-G):a(c.check,N,G,q-G)),G=J,(c.flags?A:m(A))!==c.check){v.msg="incorrect data check",c.mode=30;break}R=A=0}c.mode=28;case 28:if(c.wrap&&c.flags){for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A!==(4294967295&c.total)){v.msg="incorrect length check",c.mode=30;break}R=A=0}c.mode=29;case 29:$=1;break e;case 30:$=-3;break e;case 31:return-4;case 32:default:return p}return v.next_out=q,v.avail_out=J,v.next_in=P,v.avail_in=B,c.hold=A,c.bits=R,(c.wsize||G!==v.avail_out&&c.mode<30&&(c.mode<27||j!==4))&&te(v,v.output,v.next_out,G-v.avail_out)?(c.mode=31,-4):(Y-=v.avail_in,G-=v.avail_out,v.total_in+=Y,v.total_out+=G,c.total+=G,c.wrap&&G&&(v.adler=c.check=c.flags?o(c.check,N,G,v.next_out-G):a(c.check,N,G,v.next_out-G)),v.data_type=c.bits+(c.last?64:0)+(c.mode===12?128:0)+(c.mode===20||c.mode===15?256:0),(Y==0&&G===0||j===4)&&$===w&&($=-5),$)},i.inflateEnd=function(v){if(!v||!v.state)return p;var j=v.state;return j.window&&(j.window=null),v.state=null,w},i.inflateGetHeader=function(v,j){var c;return v&&v.state?(2&(c=v.state).wrap)==0?p:((c.head=j).done=!1,w):p},i.inflateSetDictionary=function(v,j){var c,U=j.length;return v&&v.state?(c=v.state).wrap!==0&&c.mode!==11?p:c.mode===11&&a(1,j,U,0)!==c.check?-3:te(v,j,U,U)?(c.mode=31,-4):(c.havedict=1,w):p},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,i){var s=n("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],u=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(b,g,w,p,E,f,_,m){var h,S,I,x,C,T,F,D,V,te=m.bits,v=0,j=0,c=0,U=0,N=0,P=0,q=0,B=0,J=0,A=0,R=null,Y=0,G=new s.Buf16(16),W=new s.Buf16(16),ae=null,ie=0;for(v=0;v<=15;v++)G[v]=0;for(j=0;j<p;j++)G[g[w+j]]++;for(N=te,U=15;1<=U&&G[U]===0;U--);if(U<N&&(N=U),U===0)return E[f++]=20971520,E[f++]=20971520,m.bits=1,0;for(c=1;c<U&&G[c]===0;c++);for(N<c&&(N=c),v=B=1;v<=15;v++)if(B<<=1,(B-=G[v])<0)return-1;if(0<B&&(b===0||U!==1))return-1;for(W[1]=0,v=1;v<15;v++)W[v+1]=W[v]+G[v];for(j=0;j<p;j++)g[w+j]!==0&&(_[W[g[w+j]]++]=j);if(T=b===0?(R=ae=_,19):b===1?(R=a,Y-=257,ae=o,ie-=257,256):(R=u,ae=d,-1),v=c,C=f,q=j=A=0,I=-1,x=(J=1<<(P=N))-1,b===1&&852<J||b===2&&592<J)return 1;for(;;){for(F=v-q,V=_[j]<T?(D=0,_[j]):_[j]>T?(D=ae[ie+_[j]],R[Y+_[j]]):(D=96,0),h=1<<v-q,c=S=1<<P;E[C+(A>>q)+(S-=h)]=F<<24|D<<16|V|0,S!==0;);for(h=1<<v-1;A&h;)h>>=1;if(h!==0?(A&=h-1,A+=h):A=0,j++,--G[v]==0){if(v===U)break;v=g[w+_[j]]}if(N<v&&(A&x)!==I){for(q===0&&(q=N),C+=c,B=1<<(P=v-q);P+q<U&&!((B-=G[P+q])<=0);)P++,B<<=1;if(J+=1<<P,b===1&&852<J||b===2&&592<J)return 1;E[I=A&x]=N<<24|P<<16|C-f|0}}return A!==0&&(E[C+A]=v-q<<24|64<<16|0),m.bits=N,0}},{"../utils/common":41}],51:[function(n,r,i){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,i){var s=n("../utils/common"),a=0,o=1;function u(y){for(var k=y.length;0<=--k;)y[k]=0}var d=0,b=29,g=256,w=g+1+b,p=30,E=19,f=2*w+1,_=15,m=16,h=7,S=256,I=16,x=17,C=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],F=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],te=new Array(2*(w+2));u(te);var v=new Array(2*p);u(v);var j=new Array(512);u(j);var c=new Array(256);u(c);var U=new Array(b);u(U);var N,P,q,B=new Array(p);function J(y,k,H,Z,M){this.static_tree=y,this.extra_bits=k,this.extra_base=H,this.elems=Z,this.max_length=M,this.has_stree=y&&y.length}function A(y,k){this.dyn_tree=y,this.max_code=0,this.stat_desc=k}function R(y){return y<256?j[y]:j[256+(y>>>7)]}function Y(y,k){y.pending_buf[y.pending++]=255&k,y.pending_buf[y.pending++]=k>>>8&255}function G(y,k,H){y.bi_valid>m-H?(y.bi_buf|=k<<y.bi_valid&65535,Y(y,y.bi_buf),y.bi_buf=k>>m-y.bi_valid,y.bi_valid+=H-m):(y.bi_buf|=k<<y.bi_valid&65535,y.bi_valid+=H)}function W(y,k,H){G(y,H[2*k],H[2*k+1])}function ae(y,k){for(var H=0;H|=1&y,y>>>=1,H<<=1,0<--k;);return H>>>1}function ie(y,k,H){var Z,M,X=new Array(_+1),Q=0;for(Z=1;Z<=_;Z++)X[Z]=Q=Q+H[Z-1]<<1;for(M=0;M<=k;M++){var K=y[2*M+1];K!==0&&(y[2*M]=ae(X[K]++,K))}}function re(y){var k;for(k=0;k<w;k++)y.dyn_ltree[2*k]=0;for(k=0;k<p;k++)y.dyn_dtree[2*k]=0;for(k=0;k<E;k++)y.bl_tree[2*k]=0;y.dyn_ltree[2*S]=1,y.opt_len=y.static_len=0,y.last_lit=y.matches=0}function se(y){8<y.bi_valid?Y(y,y.bi_buf):0<y.bi_valid&&(y.pending_buf[y.pending++]=y.bi_buf),y.bi_buf=0,y.bi_valid=0}function ce(y,k,H,Z){var M=2*k,X=2*H;return y[M]<y[X]||y[M]===y[X]&&Z[k]<=Z[H]}function pe(y,k,H){for(var Z=y.heap[H],M=H<<1;M<=y.heap_len&&(M<y.heap_len&&ce(k,y.heap[M+1],y.heap[M],y.depth)&&M++,!ce(k,Z,y.heap[M],y.depth));)y.heap[H]=y.heap[M],H=M,M<<=1;y.heap[H]=Z}function fe(y,k,H){var Z,M,X,Q,K=0;if(y.last_lit!==0)for(;Z=y.pending_buf[y.d_buf+2*K]<<8|y.pending_buf[y.d_buf+2*K+1],M=y.pending_buf[y.l_buf+K],K++,Z===0?W(y,M,k):(W(y,(X=c[M])+g+1,k),(Q=T[X])!==0&&G(y,M-=U[X],Q),W(y,X=R(--Z),H),(Q=F[X])!==0&&G(y,Z-=B[X],Q)),K<y.last_lit;);W(y,S,k)}function ge(y,k){var H,Z,M,X=k.dyn_tree,Q=k.stat_desc.static_tree,K=k.stat_desc.has_stree,ne=k.stat_desc.elems,de=-1;for(y.heap_len=0,y.heap_max=f,H=0;H<ne;H++)X[2*H]!==0?(y.heap[++y.heap_len]=de=H,y.depth[H]=0):X[2*H+1]=0;for(;y.heap_len<2;)X[2*(M=y.heap[++y.heap_len]=de<2?++de:0)]=1,y.depth[M]=0,y.opt_len--,K&&(y.static_len-=Q[2*M+1]);for(k.max_code=de,H=y.heap_len>>1;1<=H;H--)pe(y,X,H);for(M=ne;H=y.heap[1],y.heap[1]=y.heap[y.heap_len--],pe(y,X,1),Z=y.heap[1],y.heap[--y.heap_max]=H,y.heap[--y.heap_max]=Z,X[2*M]=X[2*H]+X[2*Z],y.depth[M]=(y.depth[H]>=y.depth[Z]?y.depth[H]:y.depth[Z])+1,X[2*H+1]=X[2*Z+1]=M,y.heap[1]=M++,pe(y,X,1),2<=y.heap_len;);y.heap[--y.heap_max]=y.heap[1],(function(ue,Oe){var We,ve,He,he,it,St,Re=Oe.dyn_tree,Vt=Oe.max_code,vr=Oe.stat_desc.static_tree,Ir=Oe.stat_desc.has_stree,Ar=Oe.stat_desc.extra_bits,Gt=Oe.stat_desc.extra_base,Ze=Oe.stat_desc.max_length,ot=0;for(he=0;he<=_;he++)ue.bl_count[he]=0;for(Re[2*ue.heap[ue.heap_max]+1]=0,We=ue.heap_max+1;We<f;We++)Ze<(he=Re[2*Re[2*(ve=ue.heap[We])+1]+1]+1)&&(he=Ze,ot++),Re[2*ve+1]=he,Vt<ve||(ue.bl_count[he]++,it=0,Gt<=ve&&(it=Ar[ve-Gt]),St=Re[2*ve],ue.opt_len+=St*(he+it),Ir&&(ue.static_len+=St*(vr[2*ve+1]+it)));if(ot!==0){do{for(he=Ze-1;ue.bl_count[he]===0;)he--;ue.bl_count[he]--,ue.bl_count[he+1]+=2,ue.bl_count[Ze]--,ot-=2}while(0<ot);for(he=Ze;he!==0;he--)for(ve=ue.bl_count[he];ve!==0;)Vt<(He=ue.heap[--We])||(Re[2*He+1]!==he&&(ue.opt_len+=(he-Re[2*He+1])*Re[2*He],Re[2*He+1]=he),ve--)}})(y,k),ie(X,de,y.bl_count)}function l(y,k,H){var Z,M,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),k[2*(H+1)+1]=65535,Z=0;Z<=H;Z++)M=Q,Q=k[2*(Z+1)+1],++K<ne&&M===Q||(K<de?y.bl_tree[2*M]+=K:M!==0?(M!==X&&y.bl_tree[2*M]++,y.bl_tree[2*I]++):K<=10?y.bl_tree[2*x]++:y.bl_tree[2*C]++,X=M,de=(K=0)===Q?(ne=138,3):M===Q?(ne=6,3):(ne=7,4))}function $(y,k,H){var Z,M,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),Z=0;Z<=H;Z++)if(M=Q,Q=k[2*(Z+1)+1],!(++K<ne&&M===Q)){if(K<de)for(;W(y,M,y.bl_tree),--K!=0;);else M!==0?(M!==X&&(W(y,M,y.bl_tree),K--),W(y,I,y.bl_tree),G(y,K-3,2)):K<=10?(W(y,x,y.bl_tree),G(y,K-3,3)):(W(y,C,y.bl_tree),G(y,K-11,7));X=M,de=(K=0)===Q?(ne=138,3):M===Q?(ne=6,3):(ne=7,4)}}u(B);var z=!1;function O(y,k,H,Z){G(y,(d<<1)+(Z?1:0),3),(function(M,X,Q,K){se(M),Y(M,Q),Y(M,~Q),s.arraySet(M.pending_buf,M.window,X,Q,M.pending),M.pending+=Q})(y,k,H)}i._tr_init=function(y){z||((function(){var k,H,Z,M,X,Q=new Array(_+1);for(M=Z=0;M<b-1;M++)for(U[M]=Z,k=0;k<1<<T[M];k++)c[Z++]=M;for(c[Z-1]=M,M=X=0;M<16;M++)for(B[M]=X,k=0;k<1<<F[M];k++)j[X++]=M;for(X>>=7;M<p;M++)for(B[M]=X<<7,k=0;k<1<<F[M]-7;k++)j[256+X++]=M;for(H=0;H<=_;H++)Q[H]=0;for(k=0;k<=143;)te[2*k+1]=8,k++,Q[8]++;for(;k<=255;)te[2*k+1]=9,k++,Q[9]++;for(;k<=279;)te[2*k+1]=7,k++,Q[7]++;for(;k<=287;)te[2*k+1]=8,k++,Q[8]++;for(ie(te,w+1,Q),k=0;k<p;k++)v[2*k+1]=5,v[2*k]=ae(k,5);N=new J(te,T,g+1,w,_),P=new J(v,F,0,p,_),q=new J(new Array(0),D,0,E,h)})(),z=!0),y.l_desc=new A(y.dyn_ltree,N),y.d_desc=new A(y.dyn_dtree,P),y.bl_desc=new A(y.bl_tree,q),y.bi_buf=0,y.bi_valid=0,re(y)},i._tr_stored_block=O,i._tr_flush_block=function(y,k,H,Z){var M,X,Q=0;0<y.level?(y.strm.data_type===2&&(y.strm.data_type=(function(K){var ne,de=4093624447;for(ne=0;ne<=31;ne++,de>>>=1)if(1&de&&K.dyn_ltree[2*ne]!==0)return a;if(K.dyn_ltree[18]!==0||K.dyn_ltree[20]!==0||K.dyn_ltree[26]!==0)return o;for(ne=32;ne<g;ne++)if(K.dyn_ltree[2*ne]!==0)return o;return a})(y)),ge(y,y.l_desc),ge(y,y.d_desc),Q=(function(K){var ne;for(l(K,K.dyn_ltree,K.l_desc.max_code),l(K,K.dyn_dtree,K.d_desc.max_code),ge(K,K.bl_desc),ne=E-1;3<=ne&&K.bl_tree[2*V[ne]+1]===0;ne--);return K.opt_len+=3*(ne+1)+5+5+4,ne})(y),M=y.opt_len+3+7>>>3,(X=y.static_len+3+7>>>3)<=M&&(M=X)):M=X=H+5,H+4<=M&&k!==-1?O(y,k,H,Z):y.strategy===4||X===M?(G(y,2+(Z?1:0),3),fe(y,te,v)):(G(y,4+(Z?1:0),3),(function(K,ne,de,ue){var Oe;for(G(K,ne-257,5),G(K,de-1,5),G(K,ue-4,4),Oe=0;Oe<ue;Oe++)G(K,K.bl_tree[2*V[Oe]+1],3);$(K,K.dyn_ltree,ne-1),$(K,K.dyn_dtree,de-1)})(y,y.l_desc.max_code+1,y.d_desc.max_code+1,Q+1),fe(y,y.dyn_ltree,y.dyn_dtree)),re(y),Z&&se(y)},i._tr_tally=function(y,k,H){return y.pending_buf[y.d_buf+2*y.last_lit]=k>>>8&255,y.pending_buf[y.d_buf+2*y.last_lit+1]=255&k,y.pending_buf[y.l_buf+y.last_lit]=255&H,y.last_lit++,k===0?y.dyn_ltree[2*H]++:(y.matches++,k--,y.dyn_ltree[2*(c[H]+g+1)]++,y.dyn_dtree[2*R(k)]++),y.last_lit===y.lit_bufsize-1},i._tr_align=function(y){G(y,2,3),W(y,S,te),(function(k){k.bi_valid===16?(Y(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)})(y)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(s){(function(a,o){if(!a.setImmediate){var u,d,b,g,w=1,p={},E=!1,f=a.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(a);_=_&&_.setTimeout?_:a,u={}.toString.call(a.process)==="[object process]"?function(I){Dr.nextTick(function(){h(I)})}:(function(){if(a.postMessage&&!a.importScripts){var I=!0,x=a.onmessage;return a.onmessage=function(){I=!1},a.postMessage("","*"),a.onmessage=x,I}})()?(g="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",S,!1):a.attachEvent("onmessage",S),function(I){a.postMessage(g+I,"*")}):a.MessageChannel?((b=new MessageChannel).port1.onmessage=function(I){h(I.data)},function(I){b.port2.postMessage(I)}):f&&"onreadystatechange"in f.createElement("script")?(d=f.documentElement,function(I){var x=f.createElement("script");x.onreadystatechange=function(){h(I),x.onreadystatechange=null,d.removeChild(x),x=null},d.appendChild(x)}):function(I){setTimeout(h,0,I)},_.setImmediate=function(I){typeof I!="function"&&(I=new Function(""+I));for(var x=new Array(arguments.length-1),C=0;C<x.length;C++)x[C]=arguments[C+1];var T={callback:I,args:x};return p[w]=T,u(w),w++},_.clearImmediate=m}function m(I){delete p[I]}function h(I){if(E)setTimeout(h,0,I);else{var x=p[I];if(x){E=!0;try{(function(C){var T=C.callback,F=C.args;switch(F.length){case 0:T();break;case 1:T(F[0]);break;case 2:T(F[0],F[1]);break;case 3:T(F[0],F[1],F[2]);break;default:T.apply(o,F)}})(x)}finally{m(I),E=!1}}}}function S(I){I.source===a&&typeof I.data=="string"&&I.data.indexOf(g)===0&&h(+I.data.slice(g.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof st<"u"?st:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wt)),wt.exports}var Fi=Bi();const vn=pn(Fi);function $i(e){const t=[],n=Object.keys(e);for(const r of n){const i=e[r];if(!i)continue;const s=i.sort((o,u)=>o.index-u.index);let a=-1;for(let o=0;o<s.length;o++)a=a+1+s[o].skip,s[o].index!==a&&t.push({message:`Invalid operation index ${s[o].index} at position ${o}`,details:{position:o,operation:s[o],scope:s[o].action.scope}})}return t}function Wi(e){const t=new vn,n=e.header;return t.file("header.json",JSON.stringify(n,null,2)),t.file("state.json",JSON.stringify(e.initialState||{},null,2)),t.file("current-state.json",JSON.stringify(e.state||{},null,2)),t.file("operations.json",JSON.stringify(zi(e.operations),null,2)),t}async function Hi(e,t){const r=await Wi(e).generateAsync({type:"blob"}),i=await t.createWritable();await i.write(r),await i.close()}async function Zi(e,t,n){const r=new vn;return await r.loadAsync(e),Vi(r,t,n)}async function Vi(e,t,n){const r=e.file("state.json");if(!r)throw new Error("Initial state not found");const i=await r.async("string"),s=JSON.parse(i),a=e.file("header.json");if(!a)throw new Error("Document header not found - file format may be outdated");const o=JSON.parse(await a.async("string")),u=e.file("operations.json");if(!u)throw new Error("Operations history not found");const d=JSON.parse(await u.async("string")),b=ft(d),g=$i(b);if(g.length){const p=g.map(E=>E.message);throw new Error(p.join(`
|
|
22
|
+
`))}return On(s,b,t,o,void 0,{},n)}const me={Remove:"remove",Replace:"replace",Add:"add"},In=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Gi=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),pt=Symbol.iterator,Ee={mutable:"mutable",immutable:"immutable"},zt={};function qe(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function en(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const r=Reflect.getOwnPropertyDescriptor(n,t);if(r)return r;n=Reflect.getPrototypeOf(n)}}}function Lt(e){return Object.getPrototypeOf(e)===Set.prototype}function Ut(e){return Object.getPrototypeOf(e)===Map.prototype}function ye(e){var t;return(t=e.copy)!==null&&t!==void 0?t:e.original}function Me(e){return!!le(e)}function le(e){return typeof e!="object"?null:e?.[In]}function jt(e){var t;const n=le(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function xe(e,t){if(!e||typeof e!="object")return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!t?.mark&&((n=t.mark(e,Ee))===Ee.immutable||typeof n=="function")}function An(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=le(De(n,e.key));if(r!==null&&r?.original!==e.original)return null;const i=e.parent.type===3,s=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>s||qe(n,s)))return null;t.push(s)}if(e.parent)return An(e.parent,t);t.reverse();try{Xi(e.copy,t)}catch{return null}return t}function Ue(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function De(e,t){return Ue(e)===2?e.get(t):e[t]}function tt(e,t,n){Ue(e)===2?e.set(t,n):e[t]=n}function xt(e,t){const n=le(e);return(n?ye(n):e)[t]}function Te(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function vt(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function ze(e,t){return t?e:[""].concat(e).map(n=>{const r=`${n}`;return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function Xi(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if(e=De(Ue(e)===3?Array.from(e):e,r),typeof e!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return e}function Ki(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach(n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);if(r.enumerable&&r.configurable&&r.writable){t[n]=e[n];return}r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r)}),t}const Ji=Object.prototype.propertyIsEnumerable;function Rn(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!Lt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}else if(e instanceof Map){if(!Ut(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Ee),n!==void 0)&&n!==Ee.mutable){if(n===Ee.immutable)return Ki(e);if(typeof n=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}else if(typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype){const r={};return Object.keys(e).forEach(i=>{r[i]=e[i]}),Object.getOwnPropertySymbols(e).forEach(i=>{Ji.call(e,i)&&(r[i]=e[i])}),r}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function _e(e){e.copy||(e.copy=Rn(e.original,e.options))}function Je(e){if(!xe(e))return jt(e);if(Array.isArray(e))return e.map(Je);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,Je(i)]);if(!Ut(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Map(n)}if(e instanceof Set){const n=Array.from(e).map(Je);if(!Lt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Set(n)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Je(e[n]);return t}function dt(e){return Me(e)?Je(e):e}function Ae(e){var t;e.assignedMap=(t=e.assignedMap)!==null&&t!==void 0?t:new Map,e.operated||(e.operated=!0,e.parent&&Ae(e.parent))}function tn(){throw new Error("Cannot modify frozen object")}function Fe(e,t,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const a=n.has(e)?n.get(e):e;if(r.length>0){const o=r.indexOf(a);if(a&&typeof a=="object"&&o!==-1)throw r[0]===a?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,o).map((u,d)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const b=r[d];return typeof u=="object"&&(b instanceof Map||b instanceof Set)?Array.from(b.keys()).indexOf(u):u}).join("/")}`);r.push(a),i.push(t)}else r.push(a)}if(Object.isFrozen(e)||Me(e)){r.pop(),i.pop();return}switch(Ue(e)){case 2:for(const[o,u]of e)Fe(o,o,n,r,i),Fe(u,o,n,r,i);e.set=e.clear=e.delete=tn;break;case 3:for(const o of e)Fe(o,o,n,r,i);e.add=e.clear=e.delete=tn;break;case 1:Object.freeze(e);let a=0;for(const o of e)Fe(o,a,n,r,i),a+=1;break;default:Object.freeze(e),Object.keys(e).forEach(o=>{const u=e[o];Fe(u,o,n,r,i)})}r.pop(),i.pop()}function Bt(e,t){const n=Ue(e);if(n===0)Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)});else if(n===1){let r=0;for(const i of e)t(r,i,e),r+=1}else e.forEach((r,i)=>t(i,r,e))}function kn(e,t,n){if(Me(e)||!xe(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),Bt(e,(s,a)=>{var o;if(Me(a)){const u=le(a);_e(u);const d=!((o=u.assignedMap)===null||o===void 0)&&o.size||u.operated?u.copy:u.original;tt(r?i:e,s,d)}else kn(a,t,n)}),i){const s=e,a=Array.from(s);s.clear(),a.forEach(o=>{s.add(i.has(o)?i.get(o):o)})}}function qi(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&kn(De(n,t),e.finalities.handledSet,e.options)}function It(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(jt(t))}))}function At(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const s=An(e);s&&t(e,s,n,r)}e.finalized=!0}}function Ft(e,t,n,r){const i=le(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((s,a)=>{var o;const u=e.type===3?e.setMap:e.copy;if(Te(De(u,t),n)){let d=i.original;i.copy&&(d=i.copy),It(e),At(e,r,s,a),e.options.enableAutoFreeze&&(e.options.updatedValues=(o=e.options.updatedValues)!==null&&o!==void 0?o:new WeakMap,e.options.updatedValues.set(d,i.original)),tt(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),xe(n,e.options)&&e.finalities.draft.push(()=>{const s=e.type===3?e.setMap:e.copy;Te(De(s,t),n)&&qi(e,t)})}function Yi(e,t,n,r,i){let{original:s,assignedMap:a,options:o}=e,u=e.copy;u.length<s.length&&([s,u]=[u,s],[n,r]=[r,n]);for(let d=0;d<s.length;d+=1)if(a.get(d.toString())&&u[d]!==s[d]){const b=t.concat([d]),g=ze(b,i);n.push({op:me.Replace,path:g,value:dt(u[d])}),r.push({op:me.Replace,path:g,value:dt(s[d])})}for(let d=s.length;d<u.length;d+=1){const b=t.concat([d]),g=ze(b,i);n.push({op:me.Add,path:g,value:dt(u[d])})}if(s.length<u.length){const{arrayLengthAssignment:d=!0}=o.enablePatches;if(d){const b=t.concat(["length"]),g=ze(b,i);r.push({op:me.Replace,path:g,value:s.length})}else for(let b=u.length;s.length<b;b-=1){const g=t.concat([b-1]),w=ze(g,i);r.push({op:me.Remove,path:w})}}}function Qi({original:e,copy:t,assignedMap:n},r,i,s,a){n.forEach((o,u)=>{const d=De(e,u),b=dt(De(t,u)),g=o?qe(e,u)?me.Replace:me.Add:me.Remove;if(Te(d,b)&&g===me.Replace)return;const w=r.concat(u),p=ze(w,a);i.push(g===me.Remove?{op:g,path:p}:{op:g,path:p,value:b}),s.push(g===me.Add?{op:me.Remove,path:p}:g===me.Remove?{op:me.Add,path:p,value:d}:{op:me.Replace,path:p,value:d})})}function eo({original:e,copy:t},n,r,i,s){let a=0;e.forEach(o=>{if(!t.has(o)){const u=n.concat([a]),d=ze(u,s);r.push({op:me.Remove,path:d,value:o}),i.unshift({op:me.Add,path:d,value:o})}a+=1}),a=0,t.forEach(o=>{if(!e.has(o)){const u=n.concat([a]),d=ze(u,s);r.push({op:me.Add,path:d,value:o}),i.unshift({op:me.Remove,path:d,value:o})}a+=1})}function Ye(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return Qi(e,t,n,r,i);case 1:return Yi(e,t,n,r,i);case 3:return eo(e,t,n,r,i)}}let Rt=!1;const ht=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!xe(e,t)||n)&&!Rt)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function to(e){Rt=!0;let t;try{t=e()}finally{Rt=!1}return t}const kt={get size(){return ye(le(this)).size},has(e){return ye(le(this)).has(e)},set(e,t){const n=le(this),r=ye(n);return(!r.has(e)||!Te(r.get(e),t))&&(_e(n),Ae(n),n.assignedMap.set(e,!0),n.copy.set(e,t),Ft(n,e,t,Ye)),this},delete(e){if(!this.has(e))return!1;const t=le(this);return _e(t),Ae(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=le(this);if(this.size){_e(e),Ae(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){const n=le(this);ye(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=le(this),i=ye(r).get(e),s=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Ee))===Ee.mutable;if(r.options.strict&&ht(i,r.options,s),s||r.finalized||!xe(i,r.options)||i!==r.original.get(e))return i;const a=zt.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return _e(r),r.copy.set(e,a),a},keys(){return ye(le(this)).keys()},values(){const e=this.keys();return{[pt]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[pt]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[pt](){return this.entries()}},no=Reflect.ownKeys(kt),nn=(e,t,{isValuesIterator:n})=>()=>{var r,i;const s=t.next();if(s.done)return s;const a=s.value;let o=e.setMap.get(a);const u=le(o),d=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,o,Ee))===Ee.mutable;if(e.options.strict&&ht(a,e.options,d),!d&&!u&&xe(a,e.options)&&!e.finalized&&e.original.has(a)){const b=zt.createDraft({original:a,parentDraft:e,key:a,finalities:e.finalities,options:e.options});e.setMap.set(a,b),o=b}else u&&(o=u.proxy);return{done:!1,value:n?o:[o,o]}},mt={get size(){return le(this).setMap.size},has(e){const t=le(this);if(t.setMap.has(e))return!0;_e(t);const n=le(e);return!!(n&&t.setMap.has(n.original))},add(e){const t=le(this);return this.has(e)||(_e(t),Ae(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),Ft(t,e,e,Ye)),this},delete(e){if(!this.has(e))return!1;const t=le(this);_e(t),Ae(t);const n=le(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=le(this);_e(e),Ae(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:nn(e,t,{isValuesIterator:!0})}},entries(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:nn(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[pt](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(mt,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const ro=Reflect.ownKeys(mt),Tn={get(e,t,n){var r,i;const s=(r=e.copy)===null||r===void 0?void 0:r[t];if(s&&e.finalities.draftsCache.has(s))return s;if(t===In)return e;let a;if(e.options.mark){const d=t==="size"&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(a=e.options.mark(d,Ee),a===Ee.mutable)return e.options.strict&&ht(d,e.options,!0),d}const o=ye(e);if(o instanceof Map&&no.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(kt,"size").get.call(e.proxy):kt[t].bind(e.proxy);if(o instanceof Set&&ro.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(mt,"size").get.call(e.proxy):mt[t].bind(e.proxy);if(!qe(o,t)){const d=en(o,t);return d?"value"in d?d.value:(i=d.get)===null||i===void 0?void 0:i.call(e.proxy):void 0}const u=o[t];if(e.options.strict&&ht(u,e.options),e.finalized||!xe(u,e.options))return u;if(u===xt(e.original,t)){if(_e(e),e.copy[t]=$t({original:e.original[t],parentDraft:e,key:e.type===1?Number(t):t,finalities:e.finalities,options:e.options}),typeof a=="function"){const d=le(e.copy[t]);return _e(d),Ae(d),d.copy}return e.copy[t]}return Me(u)&&e.finalities.draftsCache.add(u),u},set(e,t,n){var r;if(e.type===3||e.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(e.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const s=en(ye(e),t);if(s?.set)return s.set.call(e.proxy,n),!0;const a=xt(ye(e),t),o=le(a);return o&&Te(o.original,n)?(e.copy[t]=n,e.assignedMap=(r=e.assignedMap)!==null&&r!==void 0?r:new Map,e.assignedMap.set(t,!1),!0):(Te(n,a)&&(n!==void 0||qe(e.original,t))||(_e(e),Ae(e),qe(e.original,t)&&Te(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,Ft(e,t,n,Ye)),!0)},has(e,t){return t in ye(e)},ownKeys(e){return Reflect.ownKeys(ye(e))},getOwnPropertyDescriptor(e,t){const n=ye(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},getPrototypeOf(e){return Reflect.getPrototypeOf(e.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return e.type===1?Tn.set.call(this,e,t,void 0,e.proxy):(xt(e.original,t)!==void 0||t in e.original?(_e(e),Ae(e),e.assignedMap.set(t,!1)):(e.assignedMap=(n=e.assignedMap)!==null&&n!==void 0?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function $t(e){const{original:t,parentDraft:n,key:r,finalities:i,options:s}=e,a=Ue(t),o={type:a,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:s,setMap:a===3?new Map(t.entries()):void 0};(r||"key"in e)&&(o.key=r);const{proxy:u,revoke:d}=Proxy.revocable(a===1?Object.assign([],o):o,Tn);if(i.revoke.push(d),o.proxy=u,n){const b=n;b.finalities.draft.push((g,w)=>{var p,E;const f=le(u);let _=b.type===3?b.setMap:b.copy;const m=De(_,r),h=le(m);if(h){let S=h.original;h.operated&&(S=jt(m)),It(h),At(h,Ye,g,w),b.options.enableAutoFreeze&&(b.options.updatedValues=(p=b.options.updatedValues)!==null&&p!==void 0?p:new WeakMap,b.options.updatedValues.set(S,h.original)),tt(_,r,S)}(E=f.callbacks)===null||E===void 0||E.forEach(S=>{S(g,w)})})}else{const b=le(u);b.finalities.draft.push((g,w)=>{It(b),At(b,Ye,g,w)})}return u}zt.createDraft=$t;function io(e,t,n,r,i){var s;const a=le(e),o=(s=a?.original)!==null&&s!==void 0?s:e,u=!!t.length;if(a?.operated)for(;a.finalities.draft.length>0;)a.finalities.draft.pop()(n,r);const d=u?t[0]:a?a.operated?a.copy:a.original:e;return a&&vt(a),i&&Fe(d,d,a?.options.updatedValues),[d,n&&u?[{op:me.Replace,path:[],value:t[0]}]:n,r&&u?[{op:me.Replace,path:[],value:o}]:r]}function oo(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,s;t.enablePatches&&(i=[],s=[]);const o=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,Ee))===Ee.mutable||!xe(e,t)?e:$t({original:e,parentDraft:null,finalities:r,options:t});return[o,(u=[])=>{const[d,b,g]=io(o,u,i,s,t.enableAutoFreeze);return t.enablePatches?[d,b,g]:d}]}function Tt(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;Bt(n,(s,a,o)=>{const u=le(a);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const d=u.original;if(o instanceof Set){const b=Array.from(o);o.clear(),b.forEach(g=>o.add(s===g?d:g))}else tt(o,s,d)}else typeof a=="object"&&a!==null&&(e.value=a,e.isRoot=!1,Tt(e))}),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function Dn(e){var t;const n=le(e);if(!xe(e,n?.options))return e;const r=Ue(e);if(n&&!n.operated)return n.original;let i;function s(){i=r===2?Ut(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):Rn(e,n?.options)}if(n){n.finalized=!0;try{s()}finally{n.finalized=!1}}else i=e;if(Bt(i,(a,o)=>{if(n&&Te(De(n.original,a),o))return;const u=Dn(o);u!==o&&(i===e&&s(),tt(i,a,u))}),r===3){const a=(t=n?.original)!==null&&t!==void 0?t:i;return Lt(a)?new Set(i):new(Object.getPrototypeOf(a)).constructor(i)}return i}function rn(e){if(!Me(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Dn(e)}const so=e=>function t(n,r,i){var s,a,o;if(typeof n=="function"&&typeof r!="function")return function(x,...C){return t(x,T=>n.call(this,T,...C),r)};const u=n,d=r;let b=i;if(typeof r!="function"&&(b=r),b!==void 0&&Object.prototype.toString.call(b)!=="[object Object]")throw new Error(`Invalid options: ${b}, 'options' should be an object.`);b=Object.assign(Object.assign({},e),b);const g=Me(u)?rn(u):u,w=Array.isArray(b.mark)?((x,C)=>{for(const T of b.mark){if(typeof T!="function")throw new Error(`Invalid mark: ${T}, 'mark' should be a function.`);const F=T(x,C);if(F)return F}}):b.mark,p=(s=b.enablePatches)!==null&&s!==void 0?s:!1,E=(a=b.strict)!==null&&a!==void 0?a:!1,_={enableAutoFreeze:(o=b.enableAutoFreeze)!==null&&o!==void 0?o:!1,mark:w,strict:E,enablePatches:p};if(!xe(g,_)&&typeof g=="object"&&g!==null)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[m,h]=oo(g,_);if(typeof r!="function"){if(!xe(g,_))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[m,h]}let S;try{S=d(m)}catch(x){throw vt(le(m)),x}const I=x=>{const C=le(m);if(!Me(x)){if(x!==void 0&&!Te(x,m)&&C?.operated)throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const F=x?.[Gi];if(F){const D=F[0];return _.strict&&typeof x=="object"&&x!==null&&Tt({rootDraft:C,value:x,useRawReturn:!0}),h([D])}if(x!==void 0)return typeof x=="object"&&x!==null&&Tt({rootDraft:C,value:x}),h([x])}if(x===m||x===void 0)return h([]);const T=le(x);if(_===T.options){if(T.operated)throw new Error("Cannot return a modified child draft.");return h([rn(x)])}return h([x])};return S instanceof Promise?S.then(I,x=>{throw vt(le(m)),x}):I(S)},bt=so();Object.prototype.constructor.toString();function ao(e,t){return{...e,header:{...e.header,name:t}}}function lo(e,t,n){const{scope:r}=t;return bt({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const a=[...e.operations[r]],o=we(a);s.action=Mt(r);const u=o.at(-1);let d=u?.index??-1;const b=u?.action.type!=="NOOP";b?d=d+1:s.reuseLastOperationIndex=!0;const g=b?[...o,{index:d,skip:0}]:o;if(s.skip=Mi(g),u&&s.skip>u.skip+1&&(s.skip=s.skip+1),s.skip<0)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history")})}function uo(e,t,n){const{scope:r}=t;return bt({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const a=e.operations[r]||[],o=we([...a]),u=o.filter(b=>b.action.type!=="NOOP");let d=0;for(let b=o.length-1;b>=0&&o[b].action.type==="NOOP";b--)d++;if(u.length<=d)throw new Error("Cannot undo: no more operations to undo in scope history");s.action=Mt(r),s.skip=1})}function co(e,t,n){const{scope:r,input:i}=t;return bt({document:e,action:t,skip:n,reuseLastOperationIndex:!1},a=>{if(a.skip>0)throw new Error("Cannot redo: skip value from reducer cannot be used with REDO action");if(typeof i!="number"||i>1)throw new Error("Cannot redo: you can only redo one operation at a time");if(typeof i!="number"||i<1)throw new Error("Invalid REDO action: invalid redo input value");if(a.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const o=a.document.clipboard.findLastIndex(d=>d.action.scope===r);if(o<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${r}"`);const u=a.document.clipboard.splice(o,1)[0];a.action={type:u.action.type,scope:u.action.scope,input:u.action.input}})}function po(e,t){return{...e,header:{...e.header,name:t.state.name},state:t.state.data}}function Qe(e,t,n,r,i,s=Wt,a={},o){const u=Cn(n,s);return On(e,t,u,r,i,a,o)}function fo(e,t,n,r,i){if(["UNDO","REDO","PRUNE"].includes(t.type))return e;const s=t.scope;let a=[];e.operations[s]&&(a=e.operations[s].slice());const u=a.sort((g,w)=>g.index-w.index).at(-1)?.index??-1,d=n?u:u+1,b=_i(t,d,r,i);return a.push(b),{...e,operations:{...e.operations,[s]:a}}}function ho(e,t,n,r,i,s){const a=t.action.scope,o=e.operations[a],u=o?o.slice():[],b=u.sort((p,E)=>p.index-E.index).at(-1)?.index??-1,g=n?b:b+1;if(!s&&t.index-r>g)throw new Error(`Missing operations: expected ${g} with skip 0 or equivalent, got index ${t.index} with skip ${r}`);const w=bi(t,t.index,r,i);return u.push(w),{...e,operations:{...e.operations,[a]:u}}}function mo(e,t,n,r,i,s,a){let o;return s?o=ho(e,s,n,r,i,a):o=fo(e,t,n,r,i),o=xn(o,t.scope),o}function go(e,t,n){const r=si().parse(t);switch(r.type){case"SET_NAME":return ao(e,r.input);case"PRUNE":return Eo(e,r.input,n);case"LOAD_STATE":return po(e,r.input);default:return e}}function _o(e,t,n,r=1){switch(t.type){case"UNDO":return r>=2?uo(e,t,n):lo(e,t,n);case"REDO":return co(e,t,n);default:return{document:e,action:t,skip:n,reuseLastOperationIndex:!1}}}function bo(e,t,n,r,i=!1,s=Pt){const a=t.scope,o=e.operations[a];if(!o)return e;const u=o.at(-1);if(!u)return e;const d=ft({...e.operations,[a]:Ni(o,u)});let b;const w=d[a]?.at(-1);if(i&&w?.resultingState)b=s(w.resultingState);else{const{state:p}=Qe(e.initialState,d,n,e.header,void 0,void 0,void 0,{reuseOperationResultingState:i,operationResultingStateParser:s});b=p[a]}return{...e,state:{...e.state,[a]:b},operations:ft({...e.operations})}}function yo(e,t,n,r=!1,i=Pt){const s=e.operations[t];if(!s)return e;const a=[...s],o=we(a);o.pop();const u=ft({...e.operations}),d=u[t];if(!d)return e;const b=[...d],g=Li(ke(o),b),w=Qe(e.initialState,u,n,e.header,void 0,void 0,void 0,{reuseOperationResultingState:r,operationResultingStateParser:i}),p=we([...e.clipboard,...g].filter(E=>E.action.type!=="NOOP")).reverse();return{...w,clipboard:p}}function Wt(e,t,n,r,i={}){const{skip:s,ignoreSkipOperations:a=!1,reuseOperationResultingState:o=!1,operationResultingStateParser:u,pruneOnSkip:d=!0,branch:b="main"}=i;let g=gi(t),w=s??i.replayOptions?.operation.skip??0,p={...e},E=!1;const f=!a&&w>0;if(Ai(g)){const{skip:T,action:F,document:D,reuseLastOperationIndex:V}=_o(e,g,w,i.protocolVersion??1);g=F,w=T,p=D,E=V}else p={...p,clipboard:[]};Sn(g)&&(p=go(p,g,n));const _={documentId:e.header.id,scope:g.scope,branch:b};p=mo(p,g,E,w,_,i.replayOptions?.operation,i.skipIndexValidation);const m=i.protocolVersion??1;if(Jt(t)&&m<2)return yo(p,t.scope,n);const h=g.type==="NOOP"&&w>0;if((Jt(t)||h)&&m>=2){const T=g.scope,F=p.operations[T]||[],D=we([...F]),te=ki(D).filter(c=>c.action.type!=="NOOP"),v={...p.operations,[T]:te};return{...Qe(p.initialState,v,n,p.header,r,Wt,{},{skipIndexValidation:!0}),operations:p.operations,clipboard:[]}}if(f){const T=bo(p,g,n,w,o,u);d?p=T:p={...T,operations:p.operations}}if(p=bt(p,T=>{try{const F=n(T.state,g,r);F&&to(()=>{T.state=F})}catch(F){const D=p.operations[g.scope];if(!D)throw new Error(`No operations found for scope: ${g.scope}`);const V=D.length-1,te=T.operations[g.scope];if(!te)throw new Error(`No operations found in draft for scope: ${g.scope}`);if(te[V].error=F.message,te[V].skip=0,f){T.state={...e.state};const v=e.operations[g.scope];if(!v)throw new Error(`No operations found for scope: ${g.scope}`);T.operations={...e.operations,[g.scope]:[...v,{...te[V]}]}}}}),["UNDO","REDO","PRUNE"].includes(g.type))return p;const S=g.scope||"global";let I=Nt(p,S);i.replayOptions?.operation.hash&&i.replayOptions.operation.hash!==""&&(I=i.replayOptions.operation.hash);const C=p.operations[S]?.at(-1);return C&&(C.hash=I,o&&(C.resultingState=JSON.stringify(p.state[S]))),p}function Cn(e,t=Wt){return(r,i,s,a)=>t(r,i,e,s,a)}function Eo(e,t,n){const r=e.operations.global;if(!r)throw new Error("No global operations found");let{start:i,end:s}=t;i=i||0,s=s||r.length;const a=r.slice(i,s),o=r.slice(0,i),u=r.slice(s),d=Qe(e.initialState,{...e.operations,global:o.concat(a)},n,e.header),b=d.state,g=d.header.name,w=o.length,p=o.length?o[o.length-1].timestampUtcMs:u.length?u[0].timestampUtcMs:new Date().toISOString(),E=En({name:g,...b},a.length);return Qe(e.initialState,{...e.operations,global:[...o,{skip:0,...E,action:E,timestampUtcMs:p,index:w,hash:Nt({state:b},"global")},...u.map((f,_)=>({...f,index:w+_+1}))]},n,e.header)}const So="sha1",Oo="base64";function Mn(){return{}}function Nn(){return{version:0,hash:{algorithm:So,encoding:Oo}}}function Ht(){return{auth:Mn(),document:Nn()}}function wo(e){return{...Mn(),...e}}function xo(e){return{...Nn(),...e}}function vo(e,t){return{auth:wo(e),document:xo(t)}}function Pn(){return ee({__typename:be("AddChangeLogItemInput").optional(),content:L(),id:L(),insertBefore:L().nullable()})}function zn(){return ee({description:L().nullish(),id:L(),name:L()})}function Ln(){return ee({errorCode:L().nullish(),errorDescription:L().nullish(),errorName:L().nullish(),errorTemplate:L().nullish(),id:L(),operationId:L()})}function Io(){return ee({example:L(),id:L(),operationId:L()})}function Un(){return ee({description:L().nullish(),id:L(),moduleId:L(),name:L(),reducer:L().nullish(),schema:L().nullish(),template:L().nullish(),scope:Le().nullish()})}function jn(){return ee({scope:L(),example:L(),id:L(),insertBefore:L().nullish()})}function Ao(){return ee({__typename:be("Author").optional(),name:L(),website:L().nullable()})}function Bn(){return ee({__typename:be("CodeExample").optional(),id:L(),value:L()})}function Fn(){return ee({__typename:be("DeleteChangeLogItemInput").optional(),id:L()})}function $n(){return ee({id:L()})}function Wn(){return ee({id:L()})}function Ro(){return ee({id:L()})}function Hn(){return ee({id:L()})}function Zn(){return ee({scope:L(),id:L()})}function ko(){return ee({__typename:be("DocumentModelGlobalState").optional(),author:Ao(),description:L(),extension:L(),id:L(),name:L(),specifications:Se(To())})}function To(){return ee({__typename:be("DocumentSpecification").optional(),changeLog:Se(L()),modules:Se(Do()),state:Po(),version:$e().int()})}function Do(){return ee({__typename:be("ModuleSpecification").optional(),description:L().nullable(),id:L(),name:L(),operations:Se(Co())})}function Vn(){return ee({newModuleId:L(),operationId:L()})}function Co(){return ee({__typename:be("OperationSpecification").optional(),description:L().nullable(),errors:Se(Mo()),examples:Se(Bn()),id:L(),name:L().nullable(),reducer:L().nullable(),schema:L().nullable(),template:L().nullable(),scope:Le()})}function Mo(){return ee({__typename:be("OperationErrorSpecification").optional(),code:L().nullable(),description:L().nullable(),id:L(),name:L().nullable(),template:L().nullable()})}function Gn(){return ee({__typename:be("ReorderChangeLogItemsInput").optional(),order:Se(L())})}function Xn(){return ee({moduleId:L(),order:Se(L())})}function Kn(){return ee({order:Se(L())})}function Jn(){return ee({operationId:L(),order:Se(L())})}function No(){return ee({operationId:L(),order:Se(L())})}function qn(){return ee({scope:L(),order:Se(L())})}function Yn(){return ee({authorName:L()})}function Qn(){return ee({authorWebsite:L()})}function er(){return ee({scope:L(),initialValue:L()})}function tr(){return ee({description:L()})}function nr(){return ee({extension:L()})}function rr(){return ee({id:L()})}function ir(){return ee({name:L()})}function or(){return ee({description:L().nullish(),id:L()})}function sr(){return ee({id:L(),name:L().nullish()})}function ar(){return ee({description:L().nullish(),id:L()})}function lr(){return ee({errorCode:L().nullish(),id:L()})}function ur(){return ee({errorDescription:L().nullish(),id:L()})}function cr(){return ee({errorName:L().nullish(),id:L()})}function pr(){return ee({errorTemplate:L().nullish(),id:L()})}function dr(){return ee({id:L(),name:L().nullish()})}function fr(){return ee({id:L(),scope:Le()})}function hr(){return ee({id:L(),reducer:L().nullish()})}function mr(){return ee({id:L(),schema:L().nullish()})}function gr(){return ee({id:L(),template:L().nullish()})}function _r(){return ee({scope:L(),schema:L()})}function on(){return ee({__typename:be("State").optional(),examples:Se(Bn()),initialValue:L(),schema:L()})}function Po(){return ee({global:on(),local:on()})}function br(){return ee({__typename:be("UpdateChangeLogItemInput").optional(),id:L(),newContent:L()})}function zo(){return ee({example:L(),id:L()})}function yr(){return ee({scope:L(),id:L(),newExample:L()})}const Lo=e=>oe("SET_NAME",e,void 0,gn,"global"),Uo=e=>oe("SET_MODEL_NAME",{...e},void 0,ir,"global"),jo=e=>oe("SET_MODEL_ID",{...e},void 0,rr,"global"),Bo=e=>oe("SET_MODEL_EXTENSION",{...e},void 0,nr,"global"),Fo=e=>oe("SET_MODEL_DESCRIPTION",{...e},void 0,tr,"global"),$o=e=>oe("SET_AUTHOR_NAME",{...e},void 0,Yn,"global"),Wo=e=>oe("SET_AUTHOR_WEBSITE",{...e},void 0,Qn,"global"),Ho=e=>oe("ADD_MODULE",{...e},void 0,zn,"global"),Zo=e=>oe("SET_MODULE_NAME",{...e},void 0,sr,"global"),Vo=e=>oe("SET_MODULE_DESCRIPTION",{...e},void 0,or,"global"),Go=e=>oe("DELETE_MODULE",{...e},void 0,$n,"global"),Xo=e=>oe("REORDER_MODULES",{...e},void 0,Kn,"global"),Ko=e=>oe("ADD_OPERATION",{...e},void 0,Un,"global"),Jo=e=>oe("SET_OPERATION_NAME",{...e},void 0,dr,"global"),qo=e=>oe("SET_OPERATION_SCOPE",{...e},void 0,fr,"global"),Yo=e=>oe("SET_OPERATION_SCHEMA",{...e},void 0,mr,"global"),Qo=e=>oe("SET_OPERATION_DESCRIPTION",{...e},void 0,ar,"global"),es=e=>oe("SET_OPERATION_TEMPLATE",{...e},void 0,gr,"global"),ts=e=>oe("SET_OPERATION_REDUCER",{...e},void 0,hr,"global"),ns=e=>oe("MOVE_OPERATION",{...e},void 0,Vn,"global"),rs=e=>oe("DELETE_OPERATION",{...e},void 0,Hn,"global"),is=e=>oe("REORDER_MODULE_OPERATIONS",{...e},void 0,Xn,"global"),os=e=>oe("ADD_OPERATION_ERROR",{...e},void 0,Ln,"global"),ss=e=>oe("SET_OPERATION_ERROR_CODE",{...e},void 0,lr,"global"),as=e=>oe("SET_OPERATION_ERROR_NAME",{...e},void 0,cr,"global"),ls=e=>oe("SET_OPERATION_ERROR_DESCRIPTION",{...e},void 0,ur,"global"),us=e=>oe("SET_OPERATION_ERROR_TEMPLATE",{...e},void 0,pr,"global"),cs=e=>oe("DELETE_OPERATION_ERROR",{...e},void 0,Wn,"global"),ps=e=>oe("REORDER_OPERATION_ERRORS",{...e},void 0,Jn,"global"),ds=e=>oe("SET_STATE_SCHEMA",{...e},void 0,_r,"global"),fs=e=>oe("SET_INITIAL_STATE",{...e},void 0,er,"global"),hs=e=>oe("ADD_STATE_EXAMPLE",{...e},void 0,jn,"global"),ms=e=>oe("UPDATE_STATE_EXAMPLE",{...e},void 0,yr,"global"),gs=e=>oe("DELETE_STATE_EXAMPLE",{...e},void 0,Zn,"global"),_s=e=>oe("REORDER_STATE_EXAMPLES",{...e},void 0,qn,"global"),bs=e=>oe("ADD_CHANGE_LOG_ITEM",{...e},void 0,Pn,"global"),ys=e=>oe("UPDATE_CHANGE_LOG_ITEM",{...e},void 0,br,"global"),Es=e=>oe("DELETE_CHANGE_LOG_ITEM",{...e},void 0,Fn,"global"),Ss=e=>oe("REORDER_CHANGE_LOG_ITEMS",{...e},void 0,Gn,"global"),Os=()=>oe("RELEASE_NEW_VERSION",{},void 0,void 0,"global"),ws={setName:Lo,undo:fi,redo:hi,prune:mi,loadState:En,noop:Mt},xs={setModelName:Uo,setModelId:jo,setModelExtension:Bo,setModelDescription:Fo,setAuthorName:$o,setAuthorWebsite:Wo,addModule:Ho,setModuleName:Zo,setModuleDescription:Vo,deleteModule:Go,reorderModules:Xo,addOperation:Ko,setOperationName:Jo,setOperationScope:qo,setOperationSchema:Yo,setOperationDescription:Qo,setOperationTemplate:es,setOperationReducer:ts,moveOperation:ns,deleteOperation:rs,reorderModuleOperations:is,addOperationError:os,setOperationErrorCode:ss,setOperationErrorName:as,setOperationErrorDescription:ls,setOperationErrorTemplate:us,deleteOperationError:cs,reorderOperationErrors:ps,setStateSchema:ds,setInitialState:fs,addStateExample:hs,updateStateExample:ms,deleteStateExample:gs,reorderStateExamples:_s,addChangeLogItem:bs,updateChangeLogItem:ys,deleteChangeLogItem:Es,reorderChangeLogItems:Ss,releaseNewVersion:Os},vs={...ws,...xs},Is="phdm",As={},Rs={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},ks={id:"powerhouse/document-model",name:"DocumentModel",extension:"phdm",description:"The Powerhouse Document Model describes the state and operations of a document type.",author:{name:"Powerhouse",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type CodeExample {
|
|
23
|
+
id: ID!
|
|
24
|
+
value: String!
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type OperationError {
|
|
28
|
+
id: ID!
|
|
29
|
+
code: String
|
|
30
|
+
name: String
|
|
31
|
+
description: String
|
|
32
|
+
template: String
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Operation {
|
|
36
|
+
id: ID!
|
|
37
|
+
name: String
|
|
38
|
+
schema: String
|
|
39
|
+
description: String
|
|
40
|
+
template: String
|
|
41
|
+
errors: [OperationError!]!
|
|
42
|
+
examples: [CodeExample!]!
|
|
43
|
+
reducer: String
|
|
44
|
+
scope: String
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type Module {
|
|
48
|
+
id: ID!
|
|
49
|
+
name: String!
|
|
50
|
+
description: String
|
|
51
|
+
operations: [Operation!]!
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type State {
|
|
55
|
+
schema: String!
|
|
56
|
+
initialValue: String!
|
|
57
|
+
examples: [CodeExample!]!
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type ScopeState {
|
|
61
|
+
global: State!
|
|
62
|
+
local: State!
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type Author {
|
|
66
|
+
name: String!
|
|
67
|
+
website: String
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
type DocumentSpecification {
|
|
71
|
+
version: Int!
|
|
72
|
+
state: ScopeState!
|
|
73
|
+
modules: [Module!]!
|
|
74
|
+
changeLog: [String!]!
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
type DocumentModelGlobalState {
|
|
78
|
+
name: String!
|
|
79
|
+
id: String!
|
|
80
|
+
extension: String!
|
|
81
|
+
description: String!
|
|
82
|
+
author: Author!
|
|
83
|
+
specifications: [DocumentSpecification!]!
|
|
84
|
+
}`,initialValue:`{
|
|
85
|
+
"id": "",
|
|
86
|
+
"name": "",
|
|
87
|
+
"extension": "",
|
|
88
|
+
"description": "",
|
|
89
|
+
"author": {
|
|
90
|
+
"name": "",
|
|
91
|
+
"website": ""
|
|
92
|
+
},
|
|
93
|
+
"specifications": [
|
|
94
|
+
{
|
|
95
|
+
"version": 1,
|
|
96
|
+
"changeLog": [],
|
|
97
|
+
"state": {
|
|
98
|
+
"schema": "",
|
|
99
|
+
"initialValue": "",
|
|
100
|
+
"examples": []
|
|
101
|
+
},
|
|
102
|
+
"modules": []
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}`,examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[{name:"header",operations:[{name:"SET_MODEL_NAME",id:"",description:"Sets the name of the document model",schema:`input SetModelNameInput {
|
|
106
|
+
name: String!
|
|
107
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODEL_ID",id:"",description:"Sets the unique identifier for the document model",schema:`input SetModelIdInput {
|
|
108
|
+
id: String!
|
|
109
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODEL_EXTENSION",id:"",description:"Sets the file extension associated with this document model",schema:`input SetModelExtensionInput {
|
|
110
|
+
extension: String!
|
|
111
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODEL_DESCRIPTION",id:"",description:"Sets the description text for the document model",schema:`input SetModelDescriptionInput {
|
|
112
|
+
description: String!
|
|
113
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_AUTHOR_NAME",id:"",description:"Sets the name of the document model author",schema:`input SetAuthorNameInput {
|
|
114
|
+
authorName: String!
|
|
115
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_AUTHOR_WEBSITE",id:"",description:"Sets the website URL of the document model author",schema:`input SetAuthorWebsiteInput {
|
|
116
|
+
authorWebsite: String!
|
|
117
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"versioning",operations:[{name:"ADD_CHANGE_LOG_ITEM",id:"",description:"Adds a new item to the document model changelog",schema:`input AddChangeLogItemInput {
|
|
118
|
+
id: ID!
|
|
119
|
+
insertBefore: ID
|
|
120
|
+
content: String!
|
|
121
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UPDATE_CHANGE_LOG_ITEM",id:"",description:"Updates an existing changelog item",schema:`input UpdateChangeLogItemInput {
|
|
122
|
+
id: ID!
|
|
123
|
+
newContent: String!
|
|
124
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_CHANGE_LOG_ITEM",id:"",description:"Removes an item from the document model changelog",schema:`input DeleteChangeLogItemInput {
|
|
125
|
+
id: ID!
|
|
126
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_CHANGE_LOG_ITEMS",id:"",description:"Changes the order of changelog items",schema:`input ReorderChangeLogItemsInput {
|
|
127
|
+
order: [ID!]!
|
|
128
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"RELEASE_NEW_VERSION",schema:null,id:"",description:"Creates a new version of the document model specification",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"module",operations:[{name:"ADD_MODULE",id:"",description:"Adds a new module to the document model specification",schema:`input AddModuleInput {
|
|
129
|
+
id: ID!
|
|
130
|
+
name: String!
|
|
131
|
+
description: String
|
|
132
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODULE_NAME",id:"",description:"Sets the name of an existing module",schema:`input SetModuleNameInput {
|
|
133
|
+
id: ID!
|
|
134
|
+
name: String
|
|
135
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODULE_DESCRIPTION",id:"",description:"Sets the description of an existing module",schema:`input SetModuleDescriptionInput {
|
|
136
|
+
id: ID!
|
|
137
|
+
description: String
|
|
138
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_MODULE",id:"",description:"Removes a module from the document model specification",schema:`input DeleteModuleInput {
|
|
139
|
+
id: ID!
|
|
140
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_MODULES",id:"",description:"Changes the order of modules in the document model specification",schema:`input ReorderModulesInput {
|
|
141
|
+
order: [ID!]!
|
|
142
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-error",operations:[{name:"ADD_OPERATION_ERROR",id:"",description:"Adds a new error definition to an operation",schema:`input AddOperationErrorInput {
|
|
143
|
+
operationId: ID!
|
|
144
|
+
id: ID!
|
|
145
|
+
errorCode: String
|
|
146
|
+
errorName: String
|
|
147
|
+
errorDescription: String
|
|
148
|
+
errorTemplate: String
|
|
149
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_CODE",id:"",description:"Sets the error code for an operation error",schema:`input SetOperationErrorCodeInput {
|
|
150
|
+
id: ID!
|
|
151
|
+
errorCode: String
|
|
152
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_NAME",id:"",description:"Sets the name of an operation error",schema:`input SetOperationErrorNameInput {
|
|
153
|
+
id: ID!
|
|
154
|
+
errorName: String
|
|
155
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_DESCRIPTION",id:"",description:"Sets the description of an operation error",schema:`input SetOperationErrorDescriptionInput {
|
|
156
|
+
id: ID!
|
|
157
|
+
errorDescription: String
|
|
158
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_TEMPLATE",id:"",description:"Sets the template for an operation error",schema:`input SetOperationErrorTemplateInput {
|
|
159
|
+
id: ID!
|
|
160
|
+
errorTemplate: String
|
|
161
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_OPERATION_ERROR",id:"",description:"Removes an error definition from an operation",schema:`input DeleteOperationErrorInput {
|
|
162
|
+
id: ID!
|
|
163
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_OPERATION_ERRORS",id:"",description:"Changes the order of error definitions for an operation",schema:`input ReorderOperationErrorsInput {
|
|
164
|
+
operationId: ID!
|
|
165
|
+
order: [ID!]!
|
|
166
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-example",operations:[{name:"ADD_OPERATION_EXAMPLE",id:"",description:"Adds a new code example to an operation",schema:`input AddOperationExampleInput {
|
|
167
|
+
operationId: ID!
|
|
168
|
+
id: ID!
|
|
169
|
+
example: String!
|
|
170
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UPDATE_OPERATION_EXAMPLE",id:"",description:"Updates an existing code example for an operation",schema:`input UpdateOperationExampleInput {
|
|
171
|
+
id: ID!
|
|
172
|
+
example: String!
|
|
173
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_OPERATION_EXAMPLE",id:"",description:"Removes a code example from an operation",schema:`input DeleteOperationExampleInput {
|
|
174
|
+
id: ID!
|
|
175
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_OPERATION_EXAMPLES",id:"",description:"Changes the order of code examples for an operation",schema:`input ReorderOperationExamplesInput {
|
|
176
|
+
operationId: ID!
|
|
177
|
+
order: [ID!]!
|
|
178
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation",operations:[{name:"ADD_OPERATION",id:"",description:"Adds a new operation to a module",schema:`input AddOperationInput {
|
|
179
|
+
moduleId: ID!
|
|
180
|
+
id: ID!
|
|
181
|
+
name: String!
|
|
182
|
+
schema: String
|
|
183
|
+
description: String
|
|
184
|
+
template: String
|
|
185
|
+
reducer: String
|
|
186
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_NAME",id:"",description:"Sets the name of an operation",schema:`input SetOperationNameInput {
|
|
187
|
+
id: ID!
|
|
188
|
+
name: String
|
|
189
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_SCHEMA",id:"",description:"Sets the GraphQL schema definition for an operation's input",schema:`input SetOperationSchemaInput {
|
|
190
|
+
id: ID!
|
|
191
|
+
schema: String
|
|
192
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_DESCRIPTION",id:"",description:"Sets the description of an operation",schema:`input SetOperationDescriptionInput {
|
|
193
|
+
id: ID!
|
|
194
|
+
description: String
|
|
195
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_TEMPLATE",id:"",description:"Sets the template code for an operation",schema:`input SetOperationTemplateInput {
|
|
196
|
+
id: ID!
|
|
197
|
+
template: String
|
|
198
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_REDUCER",id:"",description:"Sets the reducer function code for an operation",schema:`input SetOperationReducerInput {
|
|
199
|
+
id: ID!
|
|
200
|
+
reducer: String
|
|
201
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"MOVE_OPERATION",id:"",description:"Moves an operation from one module to another",schema:`input MoveOperationInput {
|
|
202
|
+
operationId: ID!
|
|
203
|
+
newModuleId: ID!
|
|
204
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_OPERATION",id:"",description:"Removes an operation from a module",schema:`input DeleteOperationInput {
|
|
205
|
+
id: ID!
|
|
206
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_MODULE_OPERATIONS",id:"",description:"Changes the order of operations within a module",schema:`input ReorderModuleOperationsInput {
|
|
207
|
+
moduleId: ID!
|
|
208
|
+
order: [ID!]!
|
|
209
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"state",operations:[{name:"SET_STATE_SCHEMA",id:"",description:"Sets the GraphQL schema definition for document state",schema:`input SetStateSchemaInput {
|
|
210
|
+
scope: String!
|
|
211
|
+
schema: String!
|
|
212
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_INITIAL_STATE",id:"",description:"Sets the initial state value for a document scope",schema:`input SetInitialStateInput {
|
|
213
|
+
scope: String!
|
|
214
|
+
initialValue: String!
|
|
215
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ADD_STATE_EXAMPLE",id:"",description:"Adds a new state example to a document scope",schema:`input AddStateExampleInput {
|
|
216
|
+
scope: String!
|
|
217
|
+
id: ID!
|
|
218
|
+
insertBefore: ID
|
|
219
|
+
example: String!
|
|
220
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UPDATE_STATE_EXAMPLE",id:"",description:"Updates an existing state example for a document scope",schema:`input UpdateStateExampleInput {
|
|
221
|
+
scope: String!
|
|
222
|
+
id: ID!
|
|
223
|
+
newExample: String!
|
|
224
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_STATE_EXAMPLE",id:"",description:"Removes a state example from a document scope",schema:`input DeleteStateExampleInput {
|
|
225
|
+
scope: String!
|
|
226
|
+
id: ID!
|
|
227
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_STATE_EXAMPLES",id:"",description:"Changes the order of state examples for a document scope",schema:`input ReorderStateExamplesInput {
|
|
228
|
+
scope: String!
|
|
229
|
+
order: [ID!]!
|
|
230
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}]}]},Er="powerhouse/document-model",Ts=ee({id:L(),name:L(),createdAtUtcIso:L(),lastModifiedAtUtcIso:L(),documentType:L()}),Ds=ee({global:cn()}),Cs=Ts.extend({documentType:be(Er)}),gt=Ds.extend({global:ko()}),Sr=ee({header:Cs,state:gt,initialState:gt});function Ms(e){return gt.safeParse(e).success}function Ns(e){gt.parse(e)}function Ps(e){return Sr.safeParse(e).success}function zs(e){Sr.parse(e)}const Ls=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),Us=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),js=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),Bs=/[^\p{L}\d]+/giu,sn="$1\0$2",an="";function Or(e){let t=e.trim();t=t.replace(Ls,sn).replace(Us,sn),t=t.replace(Bs,"\0");let n=0,r=t.length;for(;t.charAt(n)==="\0";)n++;if(n===r)return[];for(;t.charAt(r-1)==="\0";)r--;return t.slice(n,r).split(/\0/g)}function Fs(e){const t=Or(e);for(let n=0;n<t.length;n++){const r=t[n],i=js.exec(r);if(i){const s=i.index+(i[1]??i[2]).length;t.splice(n,1,r.slice(0,s),r.slice(s))}}return t}function $s(e,t){const[n,r,i]=nt(e,t);return n+r.map(yt(t?.locale)).join(t?.delimiter??" ")+i}function ln(e,t){const[n,r,i]=nt(e,t),s=yt(t?.locale),a=Et(t?.locale),o=t?.mergeAmbiguousCharacters?Zt(s,a):Ws(s,a);return n+r.map(o).join(t?.delimiter??"")+i}function ba(e,t){const[n,r,i]=nt(e,t),s=yt(t?.locale),a=Et(t?.locale);return n+r.map(Zt(s,a)).join(" ")+i}function ya(e,t){const[n,r,i]=nt(e,t);return n+r.map(Et(t?.locale)).join("_")+i}function Ea(e,t){const[n,r,i]=nt(e,t),s=yt(t?.locale),a=Et(t?.locale),o=Zt(s,a);return n+r.map((u,d)=>d===0?o(u):s(u)).join(" ")+i}function Sa(e,t){return $s(e,{delimiter:"_",...t})}function yt(e){return e===!1?t=>t.toLowerCase():t=>t.toLocaleLowerCase(e)}function Et(e){return e===!1?t=>t.toUpperCase():t=>t.toLocaleUpperCase(e)}function Zt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Ws(e,t){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:t(i))+e(n.slice(1))}}function nt(e,t={}){const n=t.split??(t.separateNumbers?Fs:Or),r=t.prefixCharacters??an,i=t.suffixCharacters??an;let s=0,a=e.length;for(;s<e.length;){const o=e.charAt(s);if(!r.includes(o))break;s++}for(;a>s;){const o=a-1,u=e.charAt(o);if(!i.includes(u))break;a=o}return[e.slice(0,s),n(e.slice(s,a)),e.slice(a)]}const Hs=["UNDO","REDO","PRUNE","LOAD_STATE","SET_NAME","NOOP"];function Zs(e){return Hs.includes(e.toUpperCase())}function Vs(e,t){const n=e.specifications[e.specifications.length-1];if(!n)return[];const r=[];for(const i of n.modules)for(const s of i.operations)t&&s.id===t||s.name&&r.push(s.name.toUpperCase());return r}function un(e,t,n){if(!e)return;const r=e.toUpperCase();if(Zs(e))throw new Error(`Operation name "${e}" is reserved. Please use a different name.`);if(Vs(t,n).includes(r))throw new Error(`Operation name "${e}" is already used by another operation. Operation names must be unique across all modules.`)}function Oa(e,t=!1){const n=[];if(t&&e==="")return n;try{const r=JSON.parse(e);!t&&!Object.keys(r).length&&n.push({message:"Initial state cannot be empty",details:{initialState:e}})}catch{n.push({message:"Invalid initial state",details:{initialState:e}})}return n}function wa(e,t,n="",r=!0){const i=[];if(!r&&!e)return i.push({message:"State schema is required",details:{schema:e}}),i;if(r&&!e)return i;const s=`${ln(t)}${ln(n)}State`;return new RegExp(`\\btype\\s+${s}(?:\\s|\\{|@|$)`).test(e)||i.push({message:`Invalid state schema name. Expected type ${s}`,details:{schema:e}}),i}function xa(e){const t=[];e.length||t.push({message:"Modules are required",details:{modules:e}});const n=e.reduce((r,i)=>[...r,...Gs(i)],[]);return[...t,...n]}function Gs(e){const t=[];e.name||t.push({message:"Module name is required",details:{module:e}}),e.operations.length||t.push({message:"Module operations are required",details:{module:e}});const n=e.operations.reduce((r,i)=>[...r,...Xs(i)],[]);return[...t,...n]}function Xs(e){const t=[];return e.name||t.push({message:"Operation name is required",details:{operation:e}}),e.schema||t.push({message:"Operation schema is required",details:{operation:e}}),t}function rt(e){const t={};return e.forEach((n,r)=>t[n]=r),(n,r)=>(t[r.id]||999999)-(t[n.id]||999999)}const je={setModelNameOperation(e,t){e.name=t.input.name},setModelIdOperation(e,t){e.id=t.input.id},setModelExtensionOperation(e,t){e.extension=t.input.extension},setModelDescriptionOperation(e,t){e.description=t.input.description},setAuthorNameOperation(e,t){e.author=e.author||{name:"",website:null},e.author.name=t.input.authorName},setAuthorWebsiteOperation(e,t){e.author=e.author||{name:"",website:null},e.author.website=t.input.authorWebsite}},Xe={addModuleOperation(e,t){e.specifications[e.specifications.length-1].modules.push({id:t.input.id,name:t.input.name,description:t.input.description||"",operations:[]})},setModuleNameOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===t.input.id&&(n.modules[r].name=t.input.name||"")},setModuleDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===t.input.id&&(n.modules[r].description=t.input.description||"")},deleteModuleOperation(e,t){const n=e.specifications[e.specifications.length-1];n.modules=n.modules.filter(r=>r.id!=t.input.id)},reorderModulesOperation(e,t){e.specifications[e.specifications.length-1].modules.sort(rt(t.input.order))}},Pe={addOperationErrorOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].errors.push({id:t.input.id,name:t.input.errorName||"",code:t.input.errorCode||"",description:t.input.errorDescription||"",template:t.input.errorTemplate||""})},setOperationErrorCodeOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].code=t.input.errorCode||"")},setOperationErrorNameOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].name=t.input.errorName||"")},setOperationErrorDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].description=t.input.errorDescription||"")},setOperationErrorTemplateOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].template=t.input.errorTemplate||"")},deleteOperationErrorOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].errors=n.modules[r].operations[i].errors.filter(s=>s.id!=t.input.id)},reorderOperationErrorsOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].errors.sort(rt(t.input.order))}},ct={addOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].examples.push({id:t.input.id,value:t.input.example})},updateOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].examples.length;s++)n.modules[r].operations[i].examples[s].id==t.input.id&&(n.modules[r].operations[i].examples[s].value=t.input.example)},deleteOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].examples=n.modules[r].operations[i].examples.filter(s=>s.id!=t.input.id)},reorderOperationExamplesOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].examples.sort(rt(t.input.order))}},Ie={addOperationOperation(e,t){un(t.input.name,e);const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==t.input.moduleId&&n.modules[r].operations.push({id:t.input.id,name:t.input.name,description:t.input.description||"",schema:t.input.schema||"",template:t.input.template||t.input.description||"",reducer:t.input.reducer||"",errors:[],examples:[],scope:t.input.scope||"global"})},setOperationNameOperation(e,t){t.input.name&&un(t.input.name,e,t.input.id);const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].name=t.input.name||"")},setOperationScopeOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].scope=t.input.scope||"global")},setOperationSchemaOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].schema=t.input.schema||"")},setOperationDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].description=t.input.description||"")},setOperationTemplateOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].template=t.input.template||"")},setOperationReducerOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].reducer=t.input.reducer||"")},moveOperationOperation(e,t){const n=[],r=e.specifications[e.specifications.length-1];for(let i=0;i<r.modules.length;i++)r.modules[i].operations=r.modules[i].operations.filter(s=>s.id==t.input.operationId?(n.push(s),!1):!0);for(let i=0;i<r.modules.length;i++)r.modules[i].id==t.input.newModuleId&&r.modules[i].operations.push(...n)},deleteOperationOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].operations=n.modules[r].operations.filter(i=>i.id!=t.input.id)},reorderModuleOperationsOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==t.input.moduleId&&n.modules[r].operations.sort(rt(t.input.order))}},Be={setStateSchemaOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].schema=t.input.schema;else throw new Error(`Invalid scope: ${t.input.scope}`)},setInitialStateOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].initialValue=t.input.initialValue;else throw new Error(`Invalid scope: ${t.input.scope}`)},addStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples.push({id:t.input.id,value:t.input.example});else throw new Error(`Invalid scope: ${t.input.scope}`)},updateStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(!Object.keys(n.state).includes(t.input.scope))throw new Error(`Invalid scope: ${t.input.scope}`);const r=n.state[t.input.scope].examples;for(let i=0;i<r.length;i++)r[i].id==t.input.id&&(r[i].value=t.input.newExample)},deleteStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples=n.state[t.input.scope].examples.filter(r=>r.id!=t.input.id);else throw new Error(`Invalid scope: ${t.input.scope}`)},reorderStateExamplesOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples.sort(rt(t.input.order));else throw new Error(`Invalid scope: ${t.input.scope}`)}},Ke={addChangeLogItemOperation(e,t){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(e,t){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(e,t){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(e,t){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(e,t){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},Ks=(e,t)=>{if(Sn(t))return e;switch(t.type){case"SET_MODEL_NAME":ir().parse(t.input),je.setModelNameOperation(e.global,t);break;case"SET_MODEL_ID":rr().parse(t.input),je.setModelIdOperation(e.global,t);break;case"SET_MODEL_EXTENSION":nr().parse(t.input),je.setModelExtensionOperation(e.global,t);break;case"SET_MODEL_DESCRIPTION":tr().parse(t.input),je.setModelDescriptionOperation(e.global,t);break;case"SET_AUTHOR_NAME":Yn().parse(t.input),je.setAuthorNameOperation(e.global,t);break;case"SET_AUTHOR_WEBSITE":Qn().parse(t.input),je.setAuthorWebsiteOperation(e.global,t);break;case"ADD_CHANGE_LOG_ITEM":Pn().parse(t.input),Ke.addChangeLogItemOperation(e.global,t);break;case"UPDATE_CHANGE_LOG_ITEM":br().parse(t.input),Ke.updateChangeLogItemOperation(e.global,t);break;case"DELETE_CHANGE_LOG_ITEM":Fn().parse(t.input),Ke.deleteChangeLogItemOperation(e.global,t);break;case"REORDER_CHANGE_LOG_ITEMS":Gn().parse(t.input),Ke.reorderChangeLogItemsOperation(e.global,t);break;case"RELEASE_NEW_VERSION":if(Object.keys(t.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Ke.releaseNewVersionOperation(e.global,t);break;case"ADD_MODULE":zn().parse(t.input),Xe.addModuleOperation(e.global,t);break;case"SET_MODULE_NAME":sr().parse(t.input),Xe.setModuleNameOperation(e.global,t);break;case"SET_MODULE_DESCRIPTION":or().parse(t.input),Xe.setModuleDescriptionOperation(e.global,t);break;case"DELETE_MODULE":$n().parse(t.input),Xe.deleteModuleOperation(e.global,t);break;case"REORDER_MODULES":Kn().parse(t.input),Xe.reorderModulesOperation(e.global,t);break;case"ADD_OPERATION_ERROR":Ln().parse(t.input),Pe.addOperationErrorOperation(e.global,t);break;case"SET_OPERATION_ERROR_CODE":lr().parse(t.input),Pe.setOperationErrorCodeOperation(e.global,t);break;case"SET_OPERATION_ERROR_NAME":cr().parse(t.input),Pe.setOperationErrorNameOperation(e.global,t);break;case"SET_OPERATION_ERROR_DESCRIPTION":ur().parse(t.input),Pe.setOperationErrorDescriptionOperation(e.global,t);break;case"SET_OPERATION_ERROR_TEMPLATE":pr().parse(t.input),Pe.setOperationErrorTemplateOperation(e.global,t);break;case"DELETE_OPERATION_ERROR":Wn().parse(t.input),Pe.deleteOperationErrorOperation(e.global,t);break;case"REORDER_OPERATION_ERRORS":Jn().parse(t.input),Pe.reorderOperationErrorsOperation(e.global,t);break;case"ADD_OPERATION_EXAMPLE":Io().parse(t.input),ct.addOperationExampleOperation(e.global,t);break;case"UPDATE_OPERATION_EXAMPLE":zo().parse(t.input),ct.updateOperationExampleOperation(e.global,t);break;case"DELETE_OPERATION_EXAMPLE":Ro().parse(t.input),ct.deleteOperationExampleOperation(e.global,t);break;case"REORDER_OPERATION_EXAMPLES":No().parse(t.input),ct.reorderOperationExamplesOperation(e.global,t);break;case"ADD_OPERATION":Un().parse(t.input),Ie.addOperationOperation(e.global,t);break;case"SET_OPERATION_NAME":dr().parse(t.input),Ie.setOperationNameOperation(e.global,t);break;case"SET_OPERATION_SCOPE":fr().parse(t.input),Ie.setOperationScopeOperation(e.global,t);break;case"SET_OPERATION_SCHEMA":mr().parse(t.input),Ie.setOperationSchemaOperation(e.global,t);break;case"SET_OPERATION_DESCRIPTION":ar().parse(t.input),Ie.setOperationDescriptionOperation(e.global,t);break;case"SET_OPERATION_TEMPLATE":gr().parse(t.input),Ie.setOperationTemplateOperation(e.global,t);break;case"SET_OPERATION_REDUCER":hr().parse(t.input),Ie.setOperationReducerOperation(e.global,t);break;case"MOVE_OPERATION":Vn().parse(t.input),Ie.moveOperationOperation(e.global,t);break;case"DELETE_OPERATION":Hn().parse(t.input),Ie.deleteOperationOperation(e.global,t);break;case"REORDER_MODULE_OPERATIONS":Xn().parse(t.input),Ie.reorderModuleOperationsOperation(e.global,t);break;case"SET_STATE_SCHEMA":_r().parse(t.input),Be.setStateSchemaOperation(e.global,t);break;case"SET_INITIAL_STATE":er().parse(t.input),Be.setInitialStateOperation(e.global,t);break;case"ADD_STATE_EXAMPLE":jn().parse(t.input),Be.addStateExampleOperation(e.global,t);break;case"UPDATE_STATE_EXAMPLE":yr().parse(t.input),Be.updateStateExampleOperation(e.global,t);break;case"DELETE_STATE_EXAMPLE":Zn().parse(t.input),Be.deleteStateExampleOperation(e.global,t);break;case"REORDER_STATE_EXAMPLES":qn().parse(t.input),Be.reorderStateExamplesOperation(e.global,t);break;default:return e}},wr=Cn(Ks),Js=(e,t)=>Hi(e,t),qs=e=>Zi(e,wr),xr=e=>({...Ht(),global:{...Rs,...e?.global??{}},local:{...As,...e?.local??{}}});function Ys(){return{...Ht(),author:{name:"",website:""},description:"",extension:"",id:"",name:"",specifications:[]}}function Qs(){return{}}function ea(e){return{...Ys(),...e||{}}}function ta(e){return{...Qs()}}function na(e,t,n){return{...vo(e?.auth,e?.document),global:ea(t),local:ta()}}function ra(e){const t=Ri(xr,e);return t.header.documentType=Er,t}const ia=e=>Ms(e),oa=e=>{Ns(e)},sa=e=>Ps(e),aa=e=>{zs(e)},la={fileExtension:Is,createState:xr,createDocument:ra,loadFromInput:qs,saveToFileHandle:Js,isStateOfType:ia,assertIsStateOfType:oa,isDocumentOfType:sa,assertIsDocumentOfType:aa},va={reducer:wr,documentModel:na(Ht(),ks),actions:vs,utils:la};export{Er as $,fa as A,Ds as B,ut as C,Sa as D,ya as E,Ea as F,Uo as G,ds as H,jo as I,Fo as J,Bo as K,$o as L,Wo as M,fs as N,Ho as O,Zo as P,Go as Q,Jo as R,Yo as S,Qo as T,rs as U,os as V,cs as W,as as X,Ko as Y,ba as Z,pa as _,Cn as a,Wi as a0,vs as a1,Ai as a2,Oa as a3,wa as a4,xa as a5,hi as a6,fi as a7,va as a8,Ts as b,oe as c,Hi as d,Zi as e,Ri as f,bn as g,Ht as h,Sn as i,na as j,yn as k,Ii as l,Nt as m,ga as n,ke as o,ln as p,ha as q,_a as r,we as s,ma as t,Di as u,da as v,ft as w,On as x,Ni as y,Li as z};
|