@apprun/shiqu 0.7.0 → 0.8.6

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.
@@ -1,10 +1,10 @@
1
- import{c as e,d as t,f as n,l as r,n as i,o as a,r as o,s,u as c}from"./index-BBpP1F_U.js";import{a as l,r as u,t as d}from"./reader-pdf-Dcx6AQ3i.js";var f=Uint8Array,p=Uint16Array,m=Int32Array,h=new f([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,0,0,0]),g=new 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,0,0]),_=new f([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),v=function(e,t){for(var n=new p(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new m(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},y=v(h,2),b=y.b,x=y.r;b[28]=258,x[258]=28;var S=v(g,0);S.b;for(var ee=S.r,C=new p(32768),w=0;w<32768;++w){var T=(w&43690)>>1|(w&21845)<<1;T=(T&52428)>>2|(T&13107)<<2,T=(T&61680)>>4|(T&3855)<<4,C[w]=((T&65280)>>8|(T&255)<<8)>>1}for(var E=(function(e,t,n){for(var r=e.length,i=0,a=new p(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new p(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new p(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[C[d]>>c]=l}else for(s=new p(r),i=0;i<r;++i)e[i]&&(s[i]=C[o[e[i]-1]++]>>15-e[i]);return s}),D=new f(288),w=0;w<144;++w)D[w]=8;for(var w=144;w<256;++w)D[w]=9;for(var w=256;w<280;++w)D[w]=7;for(var w=280;w<288;++w)D[w]=8;for(var O=new f(32),w=0;w<32;++w)O[w]=5;var te=E(D,9,0),ne=E(O,5,0),k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new f(e.subarray(t,n))},j=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],M=function(e,t,n){var r=Error(t||j[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,M),!n)throw r;return r},N=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},P=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},F=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:B,l:0};if(i==1){var o=new f(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var m=a[0].s,r=1;r<i;++r)a[r].s>m&&(m=a[r].s);var h=new p(m+1),g=I(n[u-1],h,0);if(g>t){var r=0,_=0,v=g-t,y=1<<v;for(a.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r<i;++r){var b=a[r].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=a[r].s;h[x]<t?_-=1<<t-h[x]++-1:++r}for(;r>=0&&_;--r){var S=a[r].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new f(h),l:g}},I=function(e,t,n){return e.s==-1?Math.max(I(e.l,t,n+1),I(e.r,t,n+1)):t[e.s]=n},L=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new p(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},R=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},re=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},z=function(e,t,n,r,i,a,o,s,c,l,u){N(t,u++,n),++i[256];for(var d=F(i,15),f=d.t,m=d.l,v=F(a,15),y=v.t,b=v.l,x=L(f),S=x.c,ee=x.n,C=L(y),w=C.c,T=C.n,k=new p(19),A=0;A<S.length;++A)++k[S[A]&31];for(var A=0;A<w.length;++A)++k[w[A]&31];for(var j=F(k,7),M=j.t,I=j.l,z=19;z>4&&!M[_[z-1]];--z);var ie=l+5<<3,B=R(i,D)+R(a,O)+o,V=R(i,f)+R(a,y)+o+14+3*z+R(k,M)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&ie<=B&&ie<=V)return re(t,u,e.subarray(c,c+l));var H,U,W,G;if(N(t,u,1+(V<B)),u+=2,V<B){H=E(f,m,0),U=f,W=E(y,b,0),G=y;var K=E(M,I,0);N(t,u,ee-257),N(t,u+5,T-1),N(t,u+10,z-4),u+=14;for(var A=0;A<z;++A)N(t,u+3*A,M[_[A]]);u+=3*z;for(var ae=[S,w],q=0;q<2;++q)for(var J=ae[q],A=0;A<J.length;++A){var Y=J[A]&31;N(t,u,K[Y]),u+=M[Y],Y>15&&(N(t,u,J[A]>>5&127),u+=J[A]>>12)}}else H=te,U=D,W=ne,G=O;for(var A=0;A<s;++A){var X=r[A];if(X>255){var Y=X>>18&31;P(t,u,H[Y+257]),u+=U[Y+257],Y>7&&(N(t,u,X>>23&31),u+=h[Y]);var Z=X&31;P(t,u,W[Z]),u+=G[Z],Z>3&&(P(t,u,X>>5&8191),u+=g[Z])}else P(t,u,H[X]),u+=U[X]}return P(t,u,H[256]),u+U[256]},ie=new m([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),B=new f(0),V=function(e,t,n,r,i,a){var o=a.z||e.length,s=new f(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=ie[t-1],_=d>>13,v=d&8191,y=(1<<n)-1,b=a.p||new p(32768),S=a.h||new p(y+1),C=Math.ceil(n/3),w=2*C,T=function(t){return(e[t]^e[t+1]<<C^e[t+2]<<w)&y},E=new m(25e3),D=new p(288),O=new p(32),te=0,ne=0,j=a.i||0,M=0,N=a.w||0,P=0;j+2<o;++j){var F=T(j),I=j&32767,L=S[F];if(b[I]=L,S[F]=I,N<=j){var R=o-j;if((te>7e3||M>24576)&&(R>423||!l)){u=z(e,c,0,E,D,O,ne,M,P,j-P,u),M=te=ne=0,P=j;for(var B=0;B<286;++B)D[B]=0;for(var B=0;B<30;++B)O[B]=0}var V=2,H=0,U=v,W=I-L&32767;if(R>2&&F==T(j-W))for(var G=Math.min(_,R)-1,K=Math.min(32767,j),ae=Math.min(258,R);W<=K&&--U&&I!=L;){if(e[j+V]==e[j+V-W]){for(var q=0;q<ae&&e[j+q]==e[j+q-W];++q);if(q>V){if(V=q,H=W,q>G)break;for(var J=Math.min(W,q-2),Y=0,B=0;B<J;++B){var X=j-W+B&32767,Z=X-b[X]&32767;Z>Y&&(Y=Z,L=X)}}}I=L,L=b[I],W+=I-L&32767}if(H){E[M++]=268435456|x[V]<<18|ee[H];var oe=x[V]&31,se=ee[H]&31;ne+=h[oe]+g[se],++D[257+oe],++O[se],N=j+V,++te}else E[M++]=e[j],++D[e[j]]}}for(j=Math.max(j,N);j<o;++j)E[M++]=e[j],++D[e[j]];u=z(e,c,l,E,D,O,ne,M,P,j-P,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=S,a.p=b,a.i=j,a.w=N)}else{for(var j=a.w||0;j<o+l;j+=65535){var ce=j+65535;ce>=o&&(c[u/8|0]=l,ce=o),u=re(c,u+1,e.subarray(j,ce))}a.i=o}return A(s,0,r+k(u)+i)},H=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),U=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=H[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},W=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new f(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return V(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},G=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},K=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ae(e,t){return W(e,t||{},0,0)}var q=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=G(r,a[1]),a=a[0]),a instanceof f?n[o]=[a,s]:(n[o+=`/`]=[new f(0),s],q(a,o,n,r))}},J=typeof TextEncoder<`u`&&new TextEncoder,Y=typeof TextDecoder<`u`&&new TextDecoder;try{Y.decode(B,{stream:!0})}catch{}function X(e,t){if(t){for(var n=new f(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(J)return J.encode(e);for(var i=e.length,a=new f(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new f(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return A(a,0,o)}var Z=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&M(9),t+=r+4}return t},oe=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Z(l);K(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&M(10),K(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(K(e,t,n.crc),K(e,t+4,a<0?-a-2:a),K(e,t+8,n.size)),K(e,t+12,c),K(e,t+14,d),t+=16,o!=null&&(K(e,t,u),K(e,t+6,n.attrs),K(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;K(e,t,+m),K(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},se=function(e,t,n,r,i){K(e,t,101010256),K(e,t+8,n),K(e,t+10,n),K(e,t+12,r),K(e,t+16,i)};function ce(e,t){t||={};var n={},r=[];q(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=X(o),p=d.length,m=l.comment,h=m&&X(m),g=h&&h.length,_=Z(l.extra);p>65535&&M(11);var v=u?ae(c,l):c,y=v.length,b=U();b.p(c),r.push(G(l,{size:c.length,crc:b.d(),c:v,f:d,m:h,u:p!=o.length||h&&m.length!=g,o:i,compression:u})),i+=30+p+_+y,a+=76+2*(p+_)+(g||0)+y}for(var x=new f(a+22),S=i,ee=a-i,C=0;C<r.length;++C){var d=r[C];oe(x,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+Z(d.extra);x.set(d.c,d.o+w),oe(x,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return se(x,i,r.length,ee,S),x}var le=[`id`,`title`,`summary`,`bookId`,`theme`,`sourceReference`,`sourceText`,`sourceUrl`,`artStyleLabel`,`author`,`publication`,`aiGenerated`,`aiDisclosure`,`generationModels`,`pages`,`reflection`,`adaptationNote`,`revision`,`createdAt`,`updatedAt`],ue=c.omit({watermarkFontSize:!0}).strip();function de(e){return d(e).replace(/-拾趣\.pdf$/,`.zip`)}function fe(e,t){return`图片/${String(e+1).padStart(Math.max(2,String(t).length),`0`)}.webp`}function pe(e){if(!e.pages.length||e.pages.some(e=>!e.image))throw Error(`等所有画面生成完成后,就能下载分镜与图片 ZIP。`)}function me(t){return{...t,generated:t.aiGenerated===!0,publication:t.publication||{...e,author:t.author}}}function he(e,t,n,r){let i=`generated`in e&&e.generated===!0?e:null;return{id:e.id,title:e.title,summary:e.summary,bookId:e.bookId,theme:e.theme,sourceReference:u(e),sourceText:e.sourceText,sourceUrl:e.sourceUrl,artStyleLabel:i?.artStyleLabel??null,author:e.publication?.author||``,publication:e.publication||null,aiGenerated:i?!0:null,aiDisclosure:s(e),generationModels:i?.generationModels??[],productionPrompt:r?.productionPrompt??null,acceptancePrompt:r?.acceptancePrompt??null,promptHistoryFile:`提示词.json`,pages:e.pages.map((e,r)=>({caption:e.caption,prompt:e.prompt||null,image:t[r],...n[r]})),reflection:e.reflection,adaptationNote:e.adaptationNote,revision:e.revision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function ge(e){for(let t of le)if(!Object.hasOwn(e,t))throw Error(`故事.json 缺少公开字段:${t}`);if(e.publication&&e.publication.author!==e.author)throw Error(`公开制作署名不符。`);if(e.aiDisclosure!==s(me(e)))throw Error(`公开 AI 披露与创作方式不符。`);return{...Object.fromEntries(le.map(t=>[t,e[t]])),publication:e.publication===null?null:ue.parse(e.publication),generationModels:e.generationModels.map(({step:e,model:t})=>({step:e,model:t})),pages:e.pages.map(({caption:e,image:t,sha256:n,originalSha256:r,imagePayloadSha256:i})=>({caption:e,image:t,sha256:n,originalSha256:r,imagePayloadSha256:i}))}}function _e(e,{includePrompts:n=!0}={}){let r=n?e:ge(e),i=t(me(r));return{"分镜.md":X([`# ${r.title}`,r.summary,`主题:${r.theme}`,`出处:${r.sourceReference}`,r.sourceUrl&&`出处链接:${r.sourceUrl}`,r.artStyleLabel&&`画风:${r.artStyleLabel}`,`## 署名与转载\n\n${i}`,...r.pages.map((e,t)=>`## 第 ${t+1} 幅\n\n图片:${e.image}\n\n### 旁白\n\n${e.caption}`+(n?`\n\n### 画面提示词\n\n${e.prompt||`未留存。`}`:``)),r.reflection&&`## 余味\n\n${r.reflection}`,r.adaptationNote&&`## 改编说明\n\n${r.adaptationNote}`,r.sourceText&&`## 保存的原文\n\n${r.sourceText}`].filter(Boolean).join(`
1
+ import{a as e,c as t,d as n,l as r,n as i,o as a,r as o,s,u as c}from"./index-BPiTaaCR.js";import{a as l,r as u,t as d}from"./reader-pdf-CXa9cNDj.js";var f=Uint8Array,p=Uint16Array,m=Int32Array,h=new f([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,0,0,0]),g=new 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,0,0]),_=new f([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),v=function(e,t){for(var n=new p(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new m(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},y=v(h,2),b=y.b,x=y.r;b[28]=258,x[258]=28;var S=v(g,0);S.b;for(var ee=S.r,C=new p(32768),w=0;w<32768;++w){var T=(w&43690)>>1|(w&21845)<<1;T=(T&52428)>>2|(T&13107)<<2,T=(T&61680)>>4|(T&3855)<<4,C[w]=((T&65280)>>8|(T&255)<<8)>>1}for(var E=(function(e,t,n){for(var r=e.length,i=0,a=new p(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new p(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new p(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[C[d]>>c]=l}else for(s=new p(r),i=0;i<r;++i)e[i]&&(s[i]=C[o[e[i]-1]++]>>15-e[i]);return s}),D=new f(288),w=0;w<144;++w)D[w]=8;for(var w=144;w<256;++w)D[w]=9;for(var w=256;w<280;++w)D[w]=7;for(var w=280;w<288;++w)D[w]=8;for(var O=new f(32),w=0;w<32;++w)O[w]=5;var te=E(D,9,0),ne=E(O,5,0),k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new f(e.subarray(t,n))},j=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],M=function(e,t,n){var r=Error(t||j[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,M),!n)throw r;return r},N=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},P=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},F=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:B,l:0};if(i==1){var o=new f(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var m=a[0].s,r=1;r<i;++r)a[r].s>m&&(m=a[r].s);var h=new p(m+1),g=I(n[u-1],h,0);if(g>t){var r=0,_=0,v=g-t,y=1<<v;for(a.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r<i;++r){var b=a[r].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=a[r].s;h[x]<t?_-=1<<t-h[x]++-1:++r}for(;r>=0&&_;--r){var S=a[r].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new f(h),l:g}},I=function(e,t,n){return e.s==-1?Math.max(I(e.l,t,n+1),I(e.r,t,n+1)):t[e.s]=n},L=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new p(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},R=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},re=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},z=function(e,t,n,r,i,a,o,s,c,l,u){N(t,u++,n),++i[256];for(var d=F(i,15),f=d.t,m=d.l,v=F(a,15),y=v.t,b=v.l,x=L(f),S=x.c,ee=x.n,C=L(y),w=C.c,T=C.n,k=new p(19),A=0;A<S.length;++A)++k[S[A]&31];for(var A=0;A<w.length;++A)++k[w[A]&31];for(var j=F(k,7),M=j.t,I=j.l,z=19;z>4&&!M[_[z-1]];--z);var ie=l+5<<3,B=R(i,D)+R(a,O)+o,V=R(i,f)+R(a,y)+o+14+3*z+R(k,M)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&ie<=B&&ie<=V)return re(t,u,e.subarray(c,c+l));var H,U,W,G;if(N(t,u,1+(V<B)),u+=2,V<B){H=E(f,m,0),U=f,W=E(y,b,0),G=y;var K=E(M,I,0);N(t,u,ee-257),N(t,u+5,T-1),N(t,u+10,z-4),u+=14;for(var A=0;A<z;++A)N(t,u+3*A,M[_[A]]);u+=3*z;for(var ae=[S,w],q=0;q<2;++q)for(var J=ae[q],A=0;A<J.length;++A){var Y=J[A]&31;N(t,u,K[Y]),u+=M[Y],Y>15&&(N(t,u,J[A]>>5&127),u+=J[A]>>12)}}else H=te,U=D,W=ne,G=O;for(var A=0;A<s;++A){var X=r[A];if(X>255){var Y=X>>18&31;P(t,u,H[Y+257]),u+=U[Y+257],Y>7&&(N(t,u,X>>23&31),u+=h[Y]);var Z=X&31;P(t,u,W[Z]),u+=G[Z],Z>3&&(P(t,u,X>>5&8191),u+=g[Z])}else P(t,u,H[X]),u+=U[X]}return P(t,u,H[256]),u+U[256]},ie=new m([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),B=new f(0),V=function(e,t,n,r,i,a){var o=a.z||e.length,s=new f(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=ie[t-1],_=d>>13,v=d&8191,y=(1<<n)-1,b=a.p||new p(32768),S=a.h||new p(y+1),C=Math.ceil(n/3),w=2*C,T=function(t){return(e[t]^e[t+1]<<C^e[t+2]<<w)&y},E=new m(25e3),D=new p(288),O=new p(32),te=0,ne=0,j=a.i||0,M=0,N=a.w||0,P=0;j+2<o;++j){var F=T(j),I=j&32767,L=S[F];if(b[I]=L,S[F]=I,N<=j){var R=o-j;if((te>7e3||M>24576)&&(R>423||!l)){u=z(e,c,0,E,D,O,ne,M,P,j-P,u),M=te=ne=0,P=j;for(var B=0;B<286;++B)D[B]=0;for(var B=0;B<30;++B)O[B]=0}var V=2,H=0,U=v,W=I-L&32767;if(R>2&&F==T(j-W))for(var G=Math.min(_,R)-1,K=Math.min(32767,j),ae=Math.min(258,R);W<=K&&--U&&I!=L;){if(e[j+V]==e[j+V-W]){for(var q=0;q<ae&&e[j+q]==e[j+q-W];++q);if(q>V){if(V=q,H=W,q>G)break;for(var J=Math.min(W,q-2),Y=0,B=0;B<J;++B){var X=j-W+B&32767,Z=X-b[X]&32767;Z>Y&&(Y=Z,L=X)}}}I=L,L=b[I],W+=I-L&32767}if(H){E[M++]=268435456|x[V]<<18|ee[H];var oe=x[V]&31,se=ee[H]&31;ne+=h[oe]+g[se],++D[257+oe],++O[se],N=j+V,++te}else E[M++]=e[j],++D[e[j]]}}for(j=Math.max(j,N);j<o;++j)E[M++]=e[j],++D[e[j]];u=z(e,c,l,E,D,O,ne,M,P,j-P,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=S,a.p=b,a.i=j,a.w=N)}else{for(var j=a.w||0;j<o+l;j+=65535){var ce=j+65535;ce>=o&&(c[u/8|0]=l,ce=o),u=re(c,u+1,e.subarray(j,ce))}a.i=o}return A(s,0,r+k(u)+i)},H=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),U=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=H[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},W=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new f(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return V(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},G=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},K=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ae(e,t){return W(e,t||{},0,0)}var q=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=G(r,a[1]),a=a[0]),a instanceof f?n[o]=[a,s]:(n[o+=`/`]=[new f(0),s],q(a,o,n,r))}},J=typeof TextEncoder<`u`&&new TextEncoder,Y=typeof TextDecoder<`u`&&new TextDecoder;try{Y.decode(B,{stream:!0})}catch{}function X(e,t){if(t){for(var n=new f(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(J)return J.encode(e);for(var i=e.length,a=new f(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new f(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return A(a,0,o)}var Z=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&M(9),t+=r+4}return t},oe=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Z(l);K(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&M(10),K(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(K(e,t,n.crc),K(e,t+4,a<0?-a-2:a),K(e,t+8,n.size)),K(e,t+12,c),K(e,t+14,d),t+=16,o!=null&&(K(e,t,u),K(e,t+6,n.attrs),K(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;K(e,t,+m),K(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},se=function(e,t,n,r,i){K(e,t,101010256),K(e,t+8,n),K(e,t+10,n),K(e,t+12,r),K(e,t+16,i)};function ce(e,t){t||={};var n={},r=[];q(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=X(o),p=d.length,m=l.comment,h=m&&X(m),g=h&&h.length,_=Z(l.extra);p>65535&&M(11);var v=u?ae(c,l):c,y=v.length,b=U();b.p(c),r.push(G(l,{size:c.length,crc:b.d(),c:v,f:d,m:h,u:p!=o.length||h&&m.length!=g,o:i,compression:u})),i+=30+p+_+y,a+=76+2*(p+_)+(g||0)+y}for(var x=new f(a+22),S=i,ee=a-i,C=0;C<r.length;++C){var d=r[C];oe(x,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+Z(d.extra);x.set(d.c,d.o+w),oe(x,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return se(x,i,r.length,ee,S),x}var le=[`id`,`title`,`summary`,`bookId`,`theme`,`sourceReference`,`sourceText`,`sourceUrl`,`artStyleLabel`,`author`,`publication`,`aiGenerated`,`aiDisclosure`,`generationModels`,`pages`,`reflection`,`adaptationNote`,`revision`,`createdAt`,`updatedAt`],ue=r.omit({watermarkFontSize:!0}).strip();function de(e){return d(e).replace(/-拾趣\.pdf$/,`.zip`)}function fe(e,t){return`图片/${String(e+1).padStart(Math.max(2,String(t).length),`0`)}.webp`}function pe(e){if(!e.pages.length||e.pages.some(e=>!e.image))throw Error(`等所有画面生成完成后,就能下载分镜与图片 ZIP。`)}function me(e){return{...e,generated:e.aiGenerated===!0,publication:e.publication||{...s,author:e.author}}}function he(e,t,n,r){let i=`generated`in e&&e.generated===!0?e:null;return{id:e.id,title:e.title,summary:e.summary,bookId:e.bookId,theme:e.theme,sourceReference:u(e),sourceText:e.sourceText,sourceUrl:e.sourceUrl,artStyleLabel:i?.artStyleLabel??null,author:e.publication?.author||``,publication:e.publication||null,aiGenerated:i?!0:null,aiDisclosure:a(e),generationModels:i?.generationModels??[],productionPrompt:r?.productionPrompt??null,acceptancePrompt:r?.acceptancePrompt??null,promptHistoryFile:`提示词.json`,pages:e.pages.map((e,r)=>({caption:e.caption,prompt:e.prompt||null,image:t[r],...n[r]})),reflection:e.reflection,adaptationNote:e.adaptationNote,revision:e.revision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function ge(e){for(let t of le)if(!Object.hasOwn(e,t))throw Error(`故事.json 缺少公开字段:${t}`);if(e.publication&&e.publication.author!==e.author)throw Error(`公开制作署名不符。`);if(e.aiDisclosure!==a(me(e)))throw Error(`公开 AI 披露与创作方式不符。`);return{...Object.fromEntries(le.map(t=>[t,e[t]])),publication:e.publication===null?null:ue.parse(e.publication),generationModels:e.generationModels.map(({step:e,model:t})=>({step:e,model:t})),pages:e.pages.map(({caption:e,image:t,sha256:n,originalSha256:r,imagePayloadSha256:i})=>({caption:e,image:t,sha256:n,originalSha256:r,imagePayloadSha256:i}))}}function _e(e,{includePrompts:t=!0}={}){let n=t?e:ge(e),r=c(me(n));return{"分镜.md":X([`# ${n.title}`,n.summary,`主题:${n.theme}`,`出处:${n.sourceReference}`,n.sourceUrl&&`出处链接:${n.sourceUrl}`,n.artStyleLabel&&`画风:${n.artStyleLabel}`,`## 署名与转载\n\n${r}`,...n.pages.map((e,n)=>`## 第 ${n+1} 幅\n\n图片:${e.image}\n\n### 旁白\n\n${e.caption}`+(t?`\n\n### 画面提示词\n\n${e.prompt||`未留存。`}`:``)),n.reflection&&`## 余味\n\n${n.reflection}`,n.adaptationNote&&`## 改编说明\n\n${n.adaptationNote}`,n.sourceText&&`## 保存的原文\n\n${n.sourceText}`].filter(Boolean).join(`
2
2
 
3
3
  `)+`
4
- `),"故事.json":X(JSON.stringify(r,null,2)+`
5
- `),"署名与转载.txt":X(`${r.title}\n\n${i}\n\n原作出处:${r.sourceReference}\n${r.sourceUrl}\n\n作品编号:${r.id}\n版本:${r.revision}\n保存时间:${r.updatedAt}\n`)}}function ve(e){let t=Array.from(e.publication?.author||`未署名`);return r({...e,publication:{author:t.slice(0,18).join(``)+(t.length>18?`…`:``),workUrl:``,contact:``,sourceNote:``,reuse:``}}).replace(/^制作:/,``)}function ye(e,t,r,i){let a=ve(i),o=i.publication?.watermarkFontSize??n.default;e.save(),e.font=`300 ${o}px "PingFang SC", "Microsoft YaHei", sans-serif`,e.textAlign=`right`,e.textBaseline=`bottom`,e.shadowColor=`rgba(0,0,0,.5)`,e.shadowBlur=3,e.shadowOffsetY=1,e.fillStyle=`rgba(255,250,239,.75)`,e.fillText(a,t-t*.03,r-t*.03,t*.94),e.restore()}var be=BigInt(2**32-1),xe=BigInt(32);function Se(e,t=!1){return t?{h:Number(e&be),l:Number(e>>xe&be)}:{h:Number(e>>xe&be)|0,l:Number(e&be)|0}}function Ce(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Se(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var we=e=>e/2**32|0,Te=e=>e>>>0;function Ee(e,t,n,r){let i=we(n),a=Te(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}function De(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var Oe=e=>e?`"${e}" `:``;function ke(e,t=``){if(typeof e!=`number`)throw TypeError(Oe(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(Oe(t)+`expected integer >= 0, got `+e);return e}function Ae(e,t,n=``){if(De(e)&&(t===void 0||e.length===t))return e;t!==void 0&&ke(t,`length`);let r=De(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=Oe(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var je=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)},Me=(e,t)=>{je(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,`__proto__`))throw TypeError(`"${t}.__proto__" is not allowed`)};function Ne(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Pe(e,t){Ae(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Fe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ie(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Q(e,t){return e<<32-t|e>>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0];var Le=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,Re=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ze(e){if(Ae(e),Le)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=Re[e[n]];return t}function Be(e,t,n=`opts`){return Me(e,`defaults`),t!==void 0&&Me(t,n),Object.assign(Object.create(null),e,t)}function Ve(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=Be({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var He=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Ue(e,t,n){return e&t^~e&n}function We(e,t,n){return e&t^e&n^t&n}var Ge=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Ie(this.buffer)}update(e){Ne(this),Ae(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=Ie(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0;continue}n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){Ne(this),Pe(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),Ee(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:Ie(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},Ke=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$=new Uint32Array(64),Je=class extends Ge{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)$[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=$[e-15],n=$[e-2],r=Q(t,7)^Q(t,18)^t>>>3;$[e]=(Q(n,17)^Q(n,19)^n>>>10)+$[e-7]+r+$[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=Q(o,6)^Q(o,11)^Q(o,25),u=l+t+Ue(o,s,c)+qe[e]+$[e]|0,d=(Q(n,2)^Q(n,13)^Q(n,22))+We(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Fe($)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Fe(this.buffer)}},Ye=class extends Je{constructor(){super(32,Ke)}},Xe=Ce(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));Xe[0],Xe[1];var Ze=Ve(()=>new Ye,He(1));function Qe(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(e,n=!1)=>t.getUint16(e,n),r=(e,n=!1)=>t.getUint32(e,n),i=(t,n)=>String.fromCharCode(...e.subarray(t,t+n)),a=1,o=null;function s(e,t){if(i(e,6)===`Exif\0\0`&&(e+=6),t-e<8)throw Error(`INVALID_EXIF`);let o=i(e,2),s=o===`II`;if(o!==`II`&&o!==`MM`||n(e+2,s)!==42)throw Error(`INVALID_EXIF`);let c=e+r(e+4,s);if(c<e+8||c+2>t)throw Error(`INVALID_EXIF`);let l=n(c,s);if(c+2+l*12+4>t)throw Error(`INVALID_EXIF`);for(let e=0;e<l;e++){let t=c+2+e*12;if(n(t,s)===274&&(n(t+2,s)!==3||r(t+4,s)!==1||(a=n(t+8,s),a<1||a>8)))throw Error(`INVALID_EXIF`)}}if(i(0,8)===`‰PNG\r
4
+ `),"故事.json":X(JSON.stringify(n,null,2)+`
5
+ `),"署名与转载.txt":X(`${n.title}\n\n${r}\n\n原作出处:${n.sourceReference}\n${n.sourceUrl}\n\n作品编号:${n.id}\n版本:${n.revision}\n保存时间:${n.updatedAt}\n`)}}function ve(e){let n=Array.from(e.publication?.author||`未署名`);return t({...e,publication:{author:n.slice(0,18).join(``)+(n.length>18?`…`:``),workUrl:``,contact:``,sourceNote:``,reuse:``}}).replace(/^制作:/,``)}function ye(e,t,r,i){let a=ve(i),o=i.publication?.watermarkFontSize??n.default;e.save(),e.font=`300 ${o}px "PingFang SC", "Microsoft YaHei", sans-serif`,e.textAlign=`right`,e.textBaseline=`bottom`,e.shadowColor=`rgba(0,0,0,.5)`,e.shadowBlur=3,e.shadowOffsetY=1,e.fillStyle=`rgba(255,250,239,.75)`,e.fillText(a,t-t*.03,r-t*.03,t*.94),e.restore()}var be=BigInt(2**32-1),xe=BigInt(32);function Se(e,t=!1){return t?{h:Number(e&be),l:Number(e>>xe&be)}:{h:Number(e>>xe&be)|0,l:Number(e&be)|0}}function Ce(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Se(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var we=e=>e/2**32|0,Te=e=>e>>>0;function Ee(e,t,n,r){let i=we(n),a=Te(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}function De(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var Oe=e=>e?`"${e}" `:``;function ke(e,t=``){if(typeof e!=`number`)throw TypeError(Oe(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(Oe(t)+`expected integer >= 0, got `+e);return e}function Ae(e,t,n=``){if(De(e)&&(t===void 0||e.length===t))return e;t!==void 0&&ke(t,`length`);let r=De(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=Oe(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var je=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)},Me=(e,t)=>{je(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,`__proto__`))throw TypeError(`"${t}.__proto__" is not allowed`)};function Ne(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Pe(e,t){Ae(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Fe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ie(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Q(e,t){return e<<32-t|e>>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0];var Le=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,Re=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ze(e){if(Ae(e),Le)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=Re[e[n]];return t}function Be(e,t,n=`opts`){return Me(e,`defaults`),t!==void 0&&Me(t,n),Object.assign(Object.create(null),e,t)}function Ve(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=Be({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var He=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Ue(e,t,n){return e&t^~e&n}function We(e,t,n){return e&t^e&n^t&n}var Ge=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Ie(this.buffer)}update(e){Ne(this),Ae(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=Ie(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0;continue}n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){Ne(this),Pe(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),Ee(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:Ie(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},Ke=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$=new Uint32Array(64),Je=class extends Ge{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)$[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=$[e-15],n=$[e-2],r=Q(t,7)^Q(t,18)^t>>>3;$[e]=(Q(n,17)^Q(n,19)^n>>>10)+$[e-7]+r+$[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=Q(o,6)^Q(o,11)^Q(o,25),u=l+t+Ue(o,s,c)+qe[e]+$[e]|0,d=(Q(n,2)^Q(n,13)^Q(n,22))+We(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Fe($)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Fe(this.buffer)}},Ye=class extends Je{constructor(){super(32,Ke)}},Xe=Ce(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));Xe[0],Xe[1];var Ze=Ve(()=>new Ye,He(1));function Qe(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(e,n=!1)=>t.getUint16(e,n),r=(e,n=!1)=>t.getUint32(e,n),i=(t,n)=>String.fromCharCode(...e.subarray(t,t+n)),a=1,o=null;function s(e,t){if(i(e,6)===`Exif\0\0`&&(e+=6),t-e<8)throw Error(`INVALID_EXIF`);let o=i(e,2),s=o===`II`;if(o!==`II`&&o!==`MM`||n(e+2,s)!==42)throw Error(`INVALID_EXIF`);let c=e+r(e+4,s);if(c<e+8||c+2>t)throw Error(`INVALID_EXIF`);let l=n(c,s);if(c+2+l*12+4>t)throw Error(`INVALID_EXIF`);for(let e=0;e<l;e++){let t=c+2+e*12;if(n(t,s)===274&&(n(t+2,s)!==3||r(t+4,s)!==1||(a=n(t+8,s),a<1||a>8)))throw Error(`INVALID_EXIF`)}}if(i(0,8)===`‰PNG\r
6
6
  
7
- `){let t=8,n=!1,a=!1;for(;t+12<=e.length;){let c=r(t),l=i(t+4,4),u=t+8,d=u+c;if(d+4>e.length)return null;if(t===8){if(l!==`IHDR`||c!==13)return null;o={width:r(u),height:r(u+4)}}else if(l===`IHDR`)return null;if(l===`eXIf`&&s(u,d),l===`IDAT`&&(a=!0),t=d+4,l===`IEND`){n=c===0&&t===e.length;break}}if(!n||!a)return null}else if(e[0]===255&&e[1]===216){let t=2,r=!1;if(e.at(-2)!==255||e.at(-1)!==217)return null;for(;t<e.length-2;){if(e[t++]!==255)return null;for(;e[t]===255;)t++;let a=e[t++];if(a===0||a===217)return null;if(a===1||a>=208&&a<=215)continue;if(t+2>e.length)return null;let c=n(t),l=t+c;if(c<2||l>e.length)return null;if(a===225&&i(t+2,6)===`Exif\0\0`&&s(t+2,l),a>=192&&a<=207&&![196,200,204].includes(a)){if(c<8||c!==8+3*e[t+7])return null;o={width:n(t+5),height:n(t+3)}}if(a===218){r=l<e.length-2;break}t=l}if(!r)return null}else if(i(0,4)===`RIFF`&&i(8,4)===`WEBP`){if(e.length<20||r(4,!0)+8!==e.length)return null;let t=12,a=null;for(;t+8<=e.length;){let c=i(t,4),l=r(t+4,!0),u=t+8,d=u+l;if(d+l%2>e.length)return null;if(c===`VP8X`){if(l!==10||e[u]&2)return null;a={width:1+e[u+4]+e[u+5]*256+e[u+6]*65536,height:1+e[u+7]+e[u+8]*256+e[u+9]*65536}}else if(c===`VP8 `){if(l<10||e[u]&1||i(u+3,3)!==`*`)return null;o={width:n(u+6,!0)&16383,height:n(u+8,!0)&16383}}else if(c===`VP8L`){if(l<5||e[u]!==47)return null;let t=r(u+1,!0);o={width:1+(t&16383),height:1+(t>>>14&16383)}}else c===`EXIF`&&s(u,d);t=d+l%2}if(t!==e.length||a&&(!o||a.width!==o.width||a.height!==o.height))return null}else return null;return!o||!o.width||!o.height?null:a>=5?{width:o.height,height:o.width}:o}function $e(e){try{return Qe(e)}catch{return null}}var et=new TextEncoder,tt=new TextDecoder,nt=`RIFF ICCP/ALPH/VP8/VP8L chunks including headers and padding, in file order`,rt=e=>ze(Ze(e));function it(e){if(e.length<20||tt.decode(e.subarray(0,4))!==`RIFF`||tt.decode(e.subarray(8,12))!==`WEBP`||new DataView(e.buffer,e.byteOffset).getUint32(4,!0)+8!==e.length)throw Error(`无效的 WebP 文件。`);let t=[],n=12;for(;n<e.length;){if(n+8>e.length)throw Error(`WebP 数据不完整。`);let r=new DataView(e.buffer,e.byteOffset+n+4,4).getUint32(0,!0),i=n+8+r+r%2;if(i>e.length)throw Error(`WebP 数据不完整。`);t.push({tag:tt.decode(e.subarray(n,n+4)),bytes:e.subarray(n,i),data:e.subarray(n+8,n+8+r)}),n=i}return t}function at(e,t){let n=new Uint8Array(8+t.length+t.length%2);return n.set(et.encode(e)),new DataView(n.buffer).setUint32(4,t.length,!0),n.set(t,8),n}function ot(e){let t=Ze.create(),n=0;for(let r of it(e))[`ICCP`,`ALPH`,`VP8 `,`VP8L`].includes(r.tag)&&(t.update(r.bytes),(r.tag===`VP8 `||r.tag===`VP8L`)&&n++);if(n!==1)throw Error(`只支持单幅 WebP 插图。`);return ze(t.digest())}function st(e){return Array.from(e).filter(e=>{let t=e.codePointAt(0);return t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111}).join(``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`)}function ct(e,n,r,i){let a={StoryId:e.id,Revision:String(e.revision),Frame:String(n+1),AIGenerated:`generated`in e&&e.generated===!0?`true`:`unknown`,OriginalFileSHA256:r,ImagePayloadSHA256:i,HashScope:nt,WorkURL:e.publication?.workUrl||``,SourceURL:e.sourceUrl,Contact:e.publication?.contact||``,SourceLicense:e.publication?.sourceNote||``,Reuse:e.publication?.reuse||``};return`<?xpacket begin="\uFEFF" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:shiqu="https://github.com/yysun/shiqu/ns/1.0/" ${Object.entries(a).map(([e,t])=>`shiqu:${e}="${st(t)}"`).join(` `)}><dc:creator><rdf:Seq><rdf:li>${st(e.publication?.author||`未署名`)}</rdf:li></rdf:Seq></dc:creator><dc:title><rdf:Alt><rdf:li xml:lang="x-default">${st(e.title)}</rdf:li></rdf:Alt></dc:title><dc:description>${st(s(e))}</dc:description><dc:rights><rdf:Alt><rdf:li xml:lang="x-default">${st(t(e))}</rdf:li></rdf:Alt></dc:rights></rdf:Description></rdf:RDF></x:xmpmeta><?xpacket end="w"?>`}function lt(e,t,n,r){let i=e=>{throw Error(`第 ${n+1} 幅${e}`)};$e(e)||i(` WebP 图片结构或尺寸无效。`);for(let e of[`sha256`,`originalSha256`,`imagePayloadSha256`])/^[a-f0-9]{64}$/.test(r[e])||i(`缺少有效的 ${e}。`);rt(e)!==r.sha256&&i(`图片 SHA-256 不符。`),ot(e)!==r.imagePayloadSha256&&i(`图片像素载荷哈希不符。`);let a=it(e).filter(e=>e.tag===`XMP `);a.length!==1&&i(`缺少唯一的 XMP 署名;请重新从拾趣下载 ZIP。`);let o=tt.decode(a[0].data),s=ct(t,n,r.originalSha256,r.imagePayloadSha256);for(let[e]of s.matchAll(/shiqu:\w+="[^"]*"/g))o.includes(e)||i(` XMP ${e.split(`=`)[0]} 与故事不符;请重新从拾趣下载 ZIP。`);for(let[e,t]of[[`creator`,`制作署名`],[`description`,`AI 披露`]]){let n=s.match(RegExp(`<dc:${e}>[\\s\\S]*?</dc:${e}>`))[0];o.includes(n)||i(` XMP ${t}不符。`)}}function ut(e,t){let n=$e(e);if(!n)throw Error(`无效的静态 WebP 图片。`);let r=it(e);if(r.some(e=>[`ANIM`,`ANMF`].includes(e.tag)))throw Error(`只支持单幅 WebP 插图。`);let i=r.find(e=>e.tag===`VP8X`)?.data.slice()||new Uint8Array(10),a=r.find(e=>e.tag===`VP8L`),o=r.some(e=>e.tag===`ALPH`)||!!(a?.data[4]&&a.data[4]&16);i[0]=(r.some(e=>e.tag===`ICCP`)?32:0)|(o?16:0)|4,i.fill(0,1,4);for(let[e,t]of[[4,n.width-1],[7,n.height-1]])for(let n=0;n<3;n++)i[e+n]=t>>>8*n&255;let s=r.filter(e=>![`VP8X`,`XMP `,`EXIF`].includes(e.tag)),c=[at(`VP8X`,i),...s.map(e=>e.bytes),at(`XMP `,et.encode(t))],l=new Uint8Array(12+c.reduce((e,t)=>e+t.length,0));l.set(et.encode(`RIFF`)),new DataView(l.buffer).setUint32(4,l.length-8,!0),l.set(et.encode(`WEBP`),8);let u=12;for(let e of c)l.set(e,u),u+=e.length;return l}async function dt(e,t,n,r){let i;try{return await r.image(e,async e=>{i=r.canvas(),i.width=e.width,i.height=e.height;let t=i.getContext(`2d`);if(!t)throw Error(`CANVAS_UNAVAILABLE`);return t.drawImage(e.value,0,0),ye(t,i.width,i.height,n),await new Promise((e,t)=>i.toBlob(n=>{!n?.size||n.type!==`image/webp`?t(Error(`WEBP_UNAVAILABLE`)):e(n)},`image/webp`,.85))})}catch{throw Error(`第 ${t+1} 幅画面转为 WebP 失败,请检查图片和导出运行时。`)}finally{i&&(i.width=0,i.height=0)}}function ft(e,t){let n=new Map(t.systemPrompts.map(e=>[e.id,e]));return[`# ${e.title} · 制作提示词`,`本文件包含已保存的制作与验收要求、逐幅画面提示词,以及实际调用留存的系统指令、文本输入、输出契约与参考图路径。分享前请检查原文与自定义内容;参考图路径不代表已打包参考图文件。`,`相同系统规则只保存一次,各次调用引用 [系统提示词](系统提示词.md);不同历史规则分别保留,文本输入不做删减。`,`## 制作要求\n\n${t.productionPrompt===null?`未留存。`:t.productionPrompt||`未填写。`}`,`## 验收要求\n\n${t.acceptancePrompt===null?`未留存。`:t.acceptancePrompt||`未填写。`}`,`## 逐幅画面提示词`,...e.pages.map((e,t)=>`### 第 ${t+1} 幅\n\n${e.prompt||`未留存。`}`),`## 实际调用记录`,`以下仅为已留存的调用记录,不保证完整复现;未留存的历史不使用当前系统规则补造。`,...t.records.length?t.records.map(t=>[`### ${t.index+1} · ${t.step} · ${t.model}`,`来源版本:${t.originId}(${t.originId===e.id?`本版本实际使用`:`沿用旧版本记录`})`,o({...t.record,instructions:t.record.instructionsRef?`[${n.get(t.record.instructionsRef).label}](系统提示词.md#${t.record.instructionsRef})`:`未使用独立系统指令。`})].join(`
7
+ `){let t=8,n=!1,a=!1;for(;t+12<=e.length;){let c=r(t),l=i(t+4,4),u=t+8,d=u+c;if(d+4>e.length)return null;if(t===8){if(l!==`IHDR`||c!==13)return null;o={width:r(u),height:r(u+4)}}else if(l===`IHDR`)return null;if(l===`eXIf`&&s(u,d),l===`IDAT`&&(a=!0),t=d+4,l===`IEND`){n=c===0&&t===e.length;break}}if(!n||!a)return null}else if(e[0]===255&&e[1]===216){let t=2,r=!1;if(e.at(-2)!==255||e.at(-1)!==217)return null;for(;t<e.length-2;){if(e[t++]!==255)return null;for(;e[t]===255;)t++;let a=e[t++];if(a===0||a===217)return null;if(a===1||a>=208&&a<=215)continue;if(t+2>e.length)return null;let c=n(t),l=t+c;if(c<2||l>e.length)return null;if(a===225&&i(t+2,6)===`Exif\0\0`&&s(t+2,l),a>=192&&a<=207&&![196,200,204].includes(a)){if(c<8||c!==8+3*e[t+7])return null;o={width:n(t+5),height:n(t+3)}}if(a===218){r=l<e.length-2;break}t=l}if(!r)return null}else if(i(0,4)===`RIFF`&&i(8,4)===`WEBP`){if(e.length<20||r(4,!0)+8!==e.length)return null;let t=12,a=null;for(;t+8<=e.length;){let c=i(t,4),l=r(t+4,!0),u=t+8,d=u+l;if(d+l%2>e.length)return null;if(c===`VP8X`){if(l!==10||e[u]&2)return null;a={width:1+e[u+4]+e[u+5]*256+e[u+6]*65536,height:1+e[u+7]+e[u+8]*256+e[u+9]*65536}}else if(c===`VP8 `){if(l<10||e[u]&1||i(u+3,3)!==`*`)return null;o={width:n(u+6,!0)&16383,height:n(u+8,!0)&16383}}else if(c===`VP8L`){if(l<5||e[u]!==47)return null;let t=r(u+1,!0);o={width:1+(t&16383),height:1+(t>>>14&16383)}}else c===`EXIF`&&s(u,d);t=d+l%2}if(t!==e.length||a&&(!o||a.width!==o.width||a.height!==o.height))return null}else return null;return!o||!o.width||!o.height?null:a>=5?{width:o.height,height:o.width}:o}function $e(e){try{return Qe(e)}catch{return null}}var et=new TextEncoder,tt=new TextDecoder,nt=`RIFF ICCP/ALPH/VP8/VP8L chunks including headers and padding, in file order`,rt=e=>ze(Ze(e));function it(e){if(e.length<20||tt.decode(e.subarray(0,4))!==`RIFF`||tt.decode(e.subarray(8,12))!==`WEBP`||new DataView(e.buffer,e.byteOffset).getUint32(4,!0)+8!==e.length)throw Error(`无效的 WebP 文件。`);let t=[],n=12;for(;n<e.length;){if(n+8>e.length)throw Error(`WebP 数据不完整。`);let r=new DataView(e.buffer,e.byteOffset+n+4,4).getUint32(0,!0),i=n+8+r+r%2;if(i>e.length)throw Error(`WebP 数据不完整。`);t.push({tag:tt.decode(e.subarray(n,n+4)),bytes:e.subarray(n,i),data:e.subarray(n+8,n+8+r)}),n=i}return t}function at(e,t){let n=new Uint8Array(8+t.length+t.length%2);return n.set(et.encode(e)),new DataView(n.buffer).setUint32(4,t.length,!0),n.set(t,8),n}function ot(e){let t=Ze.create(),n=0;for(let r of it(e))[`ICCP`,`ALPH`,`VP8 `,`VP8L`].includes(r.tag)&&(t.update(r.bytes),(r.tag===`VP8 `||r.tag===`VP8L`)&&n++);if(n!==1)throw Error(`只支持单幅 WebP 插图。`);return ze(t.digest())}function st(e){return Array.from(e).filter(e=>{let t=e.codePointAt(0);return t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111}).join(``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`)}function ct(e,t,n,r){let i={StoryId:e.id,Revision:String(e.revision),Frame:String(t+1),AIGenerated:`generated`in e&&e.generated===!0?`true`:`unknown`,OriginalFileSHA256:n,ImagePayloadSHA256:r,HashScope:nt,WorkURL:e.publication?.workUrl||``,SourceURL:e.sourceUrl,Contact:e.publication?.contact||``,SourceLicense:e.publication?.sourceNote||``,Reuse:e.publication?.reuse||``};return`<?xpacket begin="\uFEFF" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:shiqu="https://github.com/yysun/shiqu/ns/1.0/" ${Object.entries(i).map(([e,t])=>`shiqu:${e}="${st(t)}"`).join(` `)}><dc:creator><rdf:Seq><rdf:li>${st(e.publication?.author||`未署名`)}</rdf:li></rdf:Seq></dc:creator><dc:title><rdf:Alt><rdf:li xml:lang="x-default">${st(e.title)}</rdf:li></rdf:Alt></dc:title><dc:description>${st(a(e))}</dc:description><dc:rights><rdf:Alt><rdf:li xml:lang="x-default">${st(c(e))}</rdf:li></rdf:Alt></dc:rights></rdf:Description></rdf:RDF></x:xmpmeta><?xpacket end="w"?>`}function lt(e,t,n,r){let i=e=>{throw Error(`第 ${n+1} 幅${e}`)};$e(e)||i(` WebP 图片结构或尺寸无效。`);for(let e of[`sha256`,`originalSha256`,`imagePayloadSha256`])/^[a-f0-9]{64}$/.test(r[e])||i(`缺少有效的 ${e}。`);rt(e)!==r.sha256&&i(`图片 SHA-256 不符。`),ot(e)!==r.imagePayloadSha256&&i(`图片像素载荷哈希不符。`);let a=it(e).filter(e=>e.tag===`XMP `);a.length!==1&&i(`缺少唯一的 XMP 署名;请重新从拾趣下载 ZIP。`);let o=tt.decode(a[0].data),s=ct(t,n,r.originalSha256,r.imagePayloadSha256);for(let[e]of s.matchAll(/shiqu:\w+="[^"]*"/g))o.includes(e)||i(` XMP ${e.split(`=`)[0]} 与故事不符;请重新从拾趣下载 ZIP。`);for(let[e,t]of[[`creator`,`制作署名`],[`description`,`AI 披露`]]){let n=s.match(RegExp(`<dc:${e}>[\\s\\S]*?</dc:${e}>`))[0];o.includes(n)||i(` XMP ${t}不符。`)}}function ut(e,t){let n=$e(e);if(!n)throw Error(`无效的静态 WebP 图片。`);let r=it(e);if(r.some(e=>[`ANIM`,`ANMF`].includes(e.tag)))throw Error(`只支持单幅 WebP 插图。`);let i=r.find(e=>e.tag===`VP8X`)?.data.slice()||new Uint8Array(10),a=r.find(e=>e.tag===`VP8L`),o=r.some(e=>e.tag===`ALPH`)||!!(a?.data[4]&&a.data[4]&16);i[0]=(r.some(e=>e.tag===`ICCP`)?32:0)|(o?16:0)|4,i.fill(0,1,4);for(let[e,t]of[[4,n.width-1],[7,n.height-1]])for(let n=0;n<3;n++)i[e+n]=t>>>8*n&255;let s=r.filter(e=>![`VP8X`,`XMP `,`EXIF`].includes(e.tag)),c=[at(`VP8X`,i),...s.map(e=>e.bytes),at(`XMP `,et.encode(t))],l=new Uint8Array(12+c.reduce((e,t)=>e+t.length,0));l.set(et.encode(`RIFF`)),new DataView(l.buffer).setUint32(4,l.length-8,!0),l.set(et.encode(`WEBP`),8);let u=12;for(let e of c)l.set(e,u),u+=e.length;return l}async function dt(e,t,n,r){let i;try{return await r.image(e,async e=>{i=r.canvas(),i.width=e.width,i.height=e.height;let t=i.getContext(`2d`);if(!t)throw Error(`CANVAS_UNAVAILABLE`);return t.drawImage(e.value,0,0),ye(t,i.width,i.height,n),await new Promise((e,t)=>i.toBlob(n=>{!n?.size||n.type!==`image/webp`?t(Error(`WEBP_UNAVAILABLE`)):e(n)},`image/webp`,.85))})}catch{throw Error(`第 ${t+1} 幅画面转为 WebP 失败,请检查图片和导出运行时。`)}finally{i&&(i.width=0,i.height=0)}}function ft(e,t){let n=new Map(t.systemPrompts.map(e=>[e.id,e]));return[`# ${e.title} · 制作提示词`,`本文件包含已保存的制作与验收要求、逐幅画面提示词,以及实际调用留存的系统指令、文本输入、输出契约与参考图路径。分享前请检查原文与自定义内容;参考图路径不代表已打包参考图文件。`,`相同系统规则只保存一次,各次调用引用 [系统提示词](系统提示词.md);不同历史规则分别保留,文本输入不做删减。`,`## 制作要求\n\n${t.productionPrompt===null?`未留存。`:t.productionPrompt||`未填写。`}`,`## 验收要求\n\n${t.acceptancePrompt===null?`未留存。`:t.acceptancePrompt||`未填写。`}`,`## 逐幅画面提示词`,...e.pages.map((e,t)=>`### 第 ${t+1} 幅\n\n${e.prompt||`未留存。`}`),`## 实际调用记录`,`以下仅为已留存的调用记录,不保证完整复现;未留存的历史不使用当前系统规则补造。`,...t.records.length?t.records.map(t=>[`### ${t.index+1} · ${t.step} · ${t.model}`,`来源版本:${t.originId}(${t.originId===e.id?`本版本实际使用`:`沿用旧版本记录`})`,o({...t.record,instructions:t.record.instructionsRef?`[${n.get(t.record.instructionsRef).label}](系统提示词.md#${t.record.instructionsRef})`:`未使用独立系统指令。`})].join(`
8
8
 
9
9
  `)):[`未留存完整提示词调用记录。`],...t.missingRecords.length?[`## 未留存完整提示词的调用`,...t.missingRecords.map(e=>`- ${e.index+1} · ${e.step} · ${e.model} · 来源版本:${e.originId} · 未留存`)]:[]].join(`
10
10
 
@@ -13,4 +13,4 @@ import{c as e,d as t,f as n,l as r,n as i,o as a,r as o,s,u as c}from"./index-BB
13
13
 
14
14
  `)+`
15
15
  `}async function mt(e,t,n=()=>{},r=l()){if(pe(e),`generated`in e&&e.generated===!0&&e&&!t)throw Error(`提示词记录未载入,无法打包 ZIP,请重试。`);await r.ready();let a={},o=[],s=[];for(let[t,i]of e.pages.entries()){n(`正在打包第 ${t+1} / ${e.pages.length} 幅`);let c=await r.read(i.image,t),l=await dt(c,t,e,r),u=fe(t,e.pages.length),d=new Uint8Array(await l.arrayBuffer()),f=rt(new Uint8Array(await c.arrayBuffer())),p=ot(d),m=ut(d,ct(e,t,f,p)),h={sha256:rt(m),originalSha256:f,imagePayloadSha256:p};lt(m,e,t,h),o.push(u),a[u]=m,s.push(h)}n(`正在整理分镜与保存 ZIP`);let c=i(t);return Object.assign(a,_e(he(e,o,s,t))),a[`提示词.md`]=X(ft(e,c)),a[`系统提示词.md`]=X(pt(e,c)),a[`提示词.json`]=X(JSON.stringify(c,null,2)+`
16
- `),new Blob([ce(a,{level:0})],{type:`application/zip`})}async function ht(e,t){pe(e),t(`正在读取已保存的提示词`);let n=await mt(e,`generated`in e&&e.generated===!0?await a(`reader/sessions/${encodeURIComponent(e.id)}/prompts`):null,t),r=URL.createObjectURL(n),i=document.createElement(`a`);return i.href=r,i.download=de(e.title),(document.querySelector(`dialog[open]`)||document.body).appendChild(i),i.click(),i.remove(),{url:r,filename:i.download}}export{ht as downloadStoryZip};
16
+ `),new Blob([ce(a,{level:0})],{type:`application/zip`})}async function ht(t,n){pe(t),n(`正在读取已保存的提示词`);let r=await mt(t,`generated`in t&&t.generated===!0?await e(`reader/sessions/${encodeURIComponent(t.id)}/prompts`):null,n),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=de(t.title),(document.querySelector(`dialog[open]`)||document.body).appendChild(a),a.click(),a.remove(),{url:i,filename:a.download}}export{ht as downloadStoryZip};
@@ -12,8 +12,8 @@
12
12
  <link rel="apple-touch-icon" sizes="180x180" href="/shiqu-home-180.png" />
13
13
  <link rel="manifest" href="/manifest.webmanifest" />
14
14
  <title>拾趣 · 片刻入戏,久久回味</title>
15
- <script type="module" crossorigin src="/assets/index-BBpP1F_U.js"></script>
16
- <link rel="stylesheet" crossorigin href="/assets/index-BOFTbC7e.css">
15
+ <script type="module" crossorigin src="/assets/index-BPiTaaCR.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index-egRwTEU4.css">
17
17
  </head>
18
18
  <body><div id="root"></div></body>
19
19
  </html>
@@ -1,4 +1,6 @@
1
- <!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#193f35"><title>拾趣 · 离线书架</title><link rel="icon" href="/icon.svg"><style>*{box-sizing:border-box}body{margin:0;background:#f6f3ec;color:#25372f;font:15px/1.7 system-ui,sans-serif}header,main{max-width:660px;margin:auto;padding:24px}header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ddd8cc}a{color:inherit}h1,h2{font-family:serif}h1{font-size:26px;margin:24px 0 8px}p{color:#7b8074}button{border:1px solid #d4d7cb;background:transparent;color:#193f35;padding:12px 18px;border-radius:8px;cursor:pointer;font:inherit}button.primary{background:#193f35;color:white}button:disabled{opacity:.4}article{margin:20px 0;padding:18px;border:1px solid #dcdccf;border-radius:12px;display:flex;gap:18px;align-items:center}article img{width:90px;border-radius:5px}article h2{font-size:20px;margin:0}article small{color:#7b8074}.caption{white-space:pre-line;font:600 25px/1.6 serif;margin:0;padding:26px 22px;background:#fffdf8;color:#233a31}.picture{display:block;width:100%}.foot{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:20px 0}.foot small{color:#7b8074}audio{width:100%;margin-top:10px}.fine{font-size:12px}#clear{margin-top:22px}.ending{background:#e9eddf;padding:24px;border-radius:10px}</style></head><body><header><strong>拾趣 <small> / 离线书架</small></strong><a href="/read">返回在线</a></header><main id="app"></main><script>
1
+ <!doctype html>
2
+ <!-- Standalone cached bookshelf and reader; external story discovery requires an internet connection. -->
3
+ <html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#193f35"><title>拾趣 · 离线书架</title><link rel="icon" href="/icon.svg"><style>*{box-sizing:border-box}body{margin:0;background:#f6f3ec;color:#25372f;font:15px/1.7 system-ui,sans-serif}header,main,footer{max-width:660px;margin:auto;padding:24px}header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ddd8cc}a{color:inherit}h1,h2{font-family:serif}h1{font-size:26px;margin:24px 0 8px}p{color:#7b8074}button{border:1px solid #d4d7cb;background:transparent;color:#193f35;padding:12px 18px;border-radius:8px;cursor:pointer;font:inherit}button.primary{background:#193f35;color:white}button:disabled{opacity:.4}article{margin:20px 0;padding:18px;border:1px solid #dcdccf;border-radius:12px;display:flex;gap:18px;align-items:center}article img{width:90px;border-radius:5px}article h2{font-size:20px;margin:0}article small{color:#7b8074}.caption{white-space:pre-line;font:600 25px/1.6 serif;margin:0;padding:26px 22px;background:#fffdf8;color:#233a31}.picture{display:block;width:100%}.foot{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:20px 0}.foot small{color:#7b8074}audio{width:100%;margin-top:10px}.fine{font-size:12px}#clear{margin-top:22px}.ending{background:#e9eddf;padding:24px;border-radius:10px}</style></head><body><header><strong>拾趣 <small> / 离线书架</small></strong><a href="/read">返回在线</a></header><main id="app"></main><footer><a href="https://yysun.github.io/awesome-shiqu/" target="_blank" rel="noopener noreferrer">在线阅读拾趣好故事 →</a><p class="fine">需要联网 · awesome-shiqu</p></footer><script>
2
4
  const app=document.querySelector('#app');let current=null,page=0;
3
5
  function el(tag,text,cls){const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(cls)n.className=cls;return n;}
4
6
  function button(text,action,cls){const b=el('button',text,cls);b.onclick=action;return b;}
package/dist/client/sw.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Refresh shell assets independently of the reader's explicitly saved offline stories.
2
- const SHELL='yiyu-shell-v9';
2
+ const SHELL='yiyu-shell-v10';
3
3
  const OFFLINE='yiyu-offline-v1';
4
4
  const ICONS=['/icon.svg','/shiqu-home-180.png','/shiqu-home-192.png','/shiqu-home-512.png'];
5
5
  self.addEventListener('install',event=>{event.waitUntil(caches.open(SHELL).then(cache=>cache.addAll(['/offline.html',...ICONS])).then(()=>self.skipWaiting()));});