@realsee/five 6.7.0-alpha.4 → 6.7.0-alpha.5

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/vfx/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/10/13
5
- * Version: 6.7.0-alpha.4
4
+ * Generated: 2025/10/15
5
+ * Version: 6.7.0-alpha.5
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/vfx/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/10/13
5
- * Version: 6.7.0-alpha.4
4
+ * Generated: 2025/10/15
5
+ * Version: 6.7.0-alpha.5
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/vue/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/10/13
5
- * Version: 6.7.0-alpha.4
4
+ * Generated: 2025/10/15
5
+ * Version: 6.7.0-alpha.5
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/vue/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/10/13
5
- * Version: 6.7.0-alpha.4
4
+ * Generated: 2025/10/15
5
+ * Version: 6.7.0-alpha.5
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/10/13
5
- * Version: 6.7.0-alpha.4
4
+ * Generated: 2025/10/15
5
+ * Version: 6.7.0-alpha.5
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,4 +252,4 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("node:fs"),N=require("node:fs/promises"),y=require("node:path"),H=require("node:stream"),K=require("sharp");function P(n,e,r,i){function a(t){return t instanceof r?t:new r(function(o){o(t)})}return new(r||(r=Promise))(function(t,o){function u(c){try{s(i.next(c))}catch(f){o(f)}}function l(c){try{s(i.throw(c))}catch(f){o(f)}}function s(c){c.done?t(c.value):a(c.value).then(u,l)}s((i=i.apply(n,e||[])).next())})}function k(n,e){var r={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,a,t,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=u(0),o.throw=u(1),o.return=u(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(s){return function(c){return l([s,c])}}function l(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(r=0)),r;)try{if(i=1,a&&(t=s[0]&2?a.return:s[0]?a.throw||((t=a.return)&&t.call(a),0):a.next)&&!(t=t.call(a,s[1])).done)return t;switch(a=0,t&&(s=[s[0]&2,t.value]),s[0]){case 0:case 1:t=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,a=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(t=r.trys,!(t=t.length>0&&t[t.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!t||s[1]>t[0]&&s[1]<t[3])){r.label=s[1];break}if(s[0]===6&&r.label<t[1]){r.label=t[1],t=s;break}if(t&&r.label<t[2]){r.label=t[2],r.ops.push(s);break}t[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(n,r)}catch(c){s=[6,c],a=0}finally{i=t=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function F(n,e){if(e&&e[e.length-1]!=="/"&&(e+="/"),n.length>e.length&&n.startsWith(e))return n.slice(e.length);throw new Error("".concat(n," is not starting with ").concat(e))}function Q(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var i=0;i<n.length;i++){var a=i===0,t=i===n.length-1,o=n[i];a||(o=o.replace(/^\.\//,"").replace(/^\/+/,"")),t||(o=o.replace(/\/+$/,"")),r.push(o)}return r.join("/")}var V=1024*1024*5;function U(n,e,r){return P(this,void 0,void 0,function(){var i,a,t,o;return k(this,function(u){switch(u.label){case 0:return q.existsSync(e)?[2,e]:[4,r(n)];case 1:return i=u.sent(),i.ok&&i.body?[4,N.mkdir(y.dirname(e),{recursive:!0})]:[3,6];case 2:return u.sent(),a=Number((o=i.headers.get("content-length"))!==null&&o!==void 0?o:"Infinity"),a>V?[2,new Promise(function(l,s){var c=H.Readable.fromWeb(i.body),f=q.createWriteStream(e);c.pipe(f),c.on("error",s),f.on("finish",function(){return l(e)})})]:[3,3];case 3:return[4,i.arrayBuffer()];case 4:return t=u.sent(),[4,N.writeFile(e,Buffer.from(t))];case 5:return u.sent(),[2,e];case 6:throw new Error("url: ".concat(n,"(").concat(i.statusText,")"))}})})}function B(n,e){return P(this,void 0,void 0,function(){var r,i,a,t,o,u,l,s,c,f;return k(this,function(g){return r=y.extname(n).slice(1)||"jpg",i=e.cut,a=e.size,t=e.format,o=t===void 0?r:t,u=K(n),i&&(u=u.extract({left:i[0],top:i[1],width:i[2],height:i[3]})),a&&(u=u.resize(a)),o&&(u=u.toFormat(o)),l="",e.toFilename?l=e.toFilename(n,{cut:e.cut,size:e.size,format:e.format}):(s="",c="",f=o,i&&(s=i.join("x")),a&&(c="".concat(a,"x")),f===r&&!c&&!s&&(f=""),l=[n,s,c,f].filter(function(d){return d.length>0}).join(".")),l!==n&&!q.existsSync(l)?[2,u.toFile(l).then(function(){return l})]:[2,l]})})}function G(n){var e=[];if(n.content&&(n.content.uri?e.push(n.content.uri):n.content.url&&e.push(n.content.url)),n.children)for(var r=0,i=n.children;r<i.length;r++){var a=i[r],t=G(a);t.length>0&&e.push.apply(e,t)}return e}function Y(n,e,r){return P(this,void 0,void 0,function(){var i,a,t;return k(this,function(o){switch(o.label){case 0:return i=new URL(n,e).href,a=y.join(r.distPath,F(i,r.baseURL)),t=U(i,a,r.fetch),r.log(function(u){return"download: ".concat(i," -> ").concat(u)},t),[4,t];case 1:return o.sent(),/\.json$/.test(n)?[4,X(i,r)]:[3,3];case 2:o.sent(),o.label=3;case 3:return[2]}})})}function X(n,e){return P(this,void 0,void 0,function(){var r,i,a,t,o,u,l,s,c,f,g,d,v,m,p,w,h,L,j;return k(this,function(b){switch(b.label){case 0:return r=y.join(e.distPath,F(n,e.baseURL)),i=U(n,r,e.fetch),e.log(function(z){return"download: ".concat(n," -> ").concat(z)},i),[4,i];case 1:return b.sent(),o=(t=JSON).parse,[4,N.readFile(r,"utf8")];case 2:return a=o.apply(t,[b.sent()]),a.asset.overview?(u=new URL(a.asset.overview.imageFile,n).href,l=y.join(e.distPath,F(u,e.baseURL)),s=U(u,l,e.fetch),e.log(function(z){return"download: ".concat(u," -> ").concat(z)},s),[4,s]):[3,4];case 3:b.sent(),b.label=4;case 4:if(!a.asset.trajectories)return[3,8];c=function(z){var R,O,S;return k(this,function(_){switch(_.label){case 0:return R=new URL(z.file,n).href,O=y.join(e.distPath,F(R,e.baseURL)),S=U(R,O,e.fetch),e.log(function($){return"download: ".concat(R," -> ").concat($)},S),[4,S];case 1:return _.sent(),[2]}})},f=0,g=a.asset.trajectories.list,b.label=5;case 5:return f<g.length?(d=g[f],[5,c(d)]):[3,8];case 6:b.sent(),b.label=7;case 7:return f++,[3,5];case 8:v=G(a.root),m=6,p=0,b.label=9;case 9:if(!(p<v.length))return[3,12];for(w=[],h=0;h<m;h++)L=v[p+h],L&&(j=Y(L,n,e),w.push(j));return[4,Promise.all(w)];case 10:b.sent(),b.label=11;case 11:return p+=m,[3,9];case 12:return[2]}})})}function Z(n,e){return P(this,void 0,void 0,function(){var r,i,a,t,o,w,u,l,s,c,f,g,d,v,m,p,w;return k(this,function(h){switch(h.label){case 0:return e.log("process model"),n.model?(r=n.model,i=r.textures,a=r.layers,t=r.file,o=r.textureBase,t?(e.log("process model file"),w=n.getURL(t),u=y.join(e.distPath,F(w,e.baseURL)),l=U(w,u,e.fetch),e.log(function(L){return"download: ".concat(t," -> ").concat(L)},l),[4,l]):[3,5]):[3,9];case 1:if(h.sent(),!i)return[3,5];s=function(L){var j,b,z,R,O,S,_,$,W,I,C,A,J;return k(this,function(D){switch(D.label){case 0:return j=Q(n.getURL(o!=null?o:""),L),b=y.join(e.distPath,F(j,e.baseURL)),z=U(j,b,e.fetch),e.log(function(M){return"download: ".concat(j," -> ").concat(M)},z),[4,z];case 1:for(D.sent(),R=e.imageOptions.format,R.length===0&&R.push(void 0),O=e.imageOptions.size,O.length===0&&O.push(void 0),S=[],_=0,$=R;_<$.length;_++)for(W=$[_],I=0,C=O;I<C.length;I++)A=C[I],J=B(b,{format:W,size:A,toFilename:e.imageProcessingFilename}),e.log(function(M){return"imageProcessing: ".concat(b," -> ").concat(M)},J),S.push(J);return[4,Promise.all(S)];case 2:return D.sent(),[2]}})},c=0,f=i,h.label=2;case 2:return c<f.length?(g=f[c],[5,s(g)]):[3,5];case 3:h.sent(),h.label=4;case 4:return c++,[3,2];case 5:if(!a)return[3,9];d=0,v=a,h.label=6;case 6:return d<v.length?(m=v[d],p=m.tileset,e.log("process model layer"),w=n.getURL(p),[4,X(w,e)]):[3,9];case 7:h.sent(),h.label=8;case 8:return d++,[3,6];case 9:return[2]}})})}function T(n,e,r){return P(this,void 0,void 0,function(){var i,a,t,o,u,l,s,c,f,g,d,v,m,p;return k(this,function(w){switch(w.label){case 0:return i=y.join(r.distPath,F(n,r.baseURL)),a=U(n,i,r.fetch),r.log(function(h){return"download: ".concat(n," -> ").concat(h)},a),[4,a];case 1:if(w.sent(),t=Math.pow(2,e.level),o=r.imageOptions.format,o.length===0&&o.push(void 0),u=[],t>1)for(l=0;l<t;l++)for(s=0;s<t;s++)for(c=0,f=o;c<f.length;c++)g=f[c],d=[e.size/t*s,e.size/t*l,e.size/t,e.size/t],v=e.scale>=1?void 0:e.scale*e.size/t,m=B(i,{format:g,size:v,cut:d,toFilename:r.imageProcessingFilename}),r.log(function(h){return"imageProcessing: ".concat(i," -> ").concat(h)},m),u.push(m),e.level===1&&e.scale>=.5&&(g==="jpg"||/\.jpg$/.test(i))&&(p=B(i,{format:g,size:void 0,cut:d,toFilename:r.imageProcessingFilename}),r.log(function(h){return"imageProcessing: ".concat(i," -> ").concat(h)},p),u.push(p));return[4,Promise.all(u)];case 2:return w.sent(),[2]}})})}function x(n,e){return P(this,void 0,void 0,function(){return k(this,function(r){switch(r.label){case 0:return[4,Promise.all([T(n.work.getURL(n.front),n,e),T(n.work.getURL(n.back),n,e),T(n.work.getURL(n.left),n,e),T(n.work.getURL(n.right),n,e),T(n.work.getURL(n.up),n,e),T(n.work.getURL(n.down),n,e)])];case 1:return r.sent(),[2]}})})}function E(n,e){return P(this,void 0,void 0,function(){var r,i,a,t,o,u,l,s,c,f,g,d;return k(this,function(v){switch(v.label){case 0:return r=y.join(e.distPath,F(n,e.baseURL)),i=U(n,r,e.fetch),e.log(function(m){return"download: ".concat(n," -> ").concat(m)},i),[4,i];case 1:for(v.sent(),a=e.imageOptions.format,a.length===0&&a.push(void 0),t=e.imageOptions.size,t.length===0&&t.push(void 0),o=[],u=0,l=a;u<l.length;u++)for(s=l[u],c=0,f=t;c<f.length;c++)g=f[c],d=B(r,{format:s,size:g,toFilename:e.imageProcessingFilename}),e.log(function(m){return"imageProcessing: ".concat(r," -> ").concat(m)},d),o.push(d);return[4,Promise.all(o)];case 2:return v.sent(),[2]}})})}function ee(n,e){return P(this,void 0,void 0,function(){var r;return k(this,function(i){switch(i.label){case 0:return r=n.images,[4,Promise.all([E(r.work.getURL(r.front),e),E(r.work.getURL(r.back),e),E(r.work.getURL(r.left),e),E(r.work.getURL(r.right),e),E(r.work.getURL(r.up),e),E(r.work.getURL(r.down),e)])];case 1:return i.sent(),r.tiles?[4,Promise.all(r.tiles.map(function(a){return x(a,e)}))]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})}function re(n,e){return P(this,void 0,void 0,function(){var r,i,a,t,o;return k(this,function(u){switch(u.label){case 0:r=n.observers,i=0,a=r,u.label=1;case 1:return i<a.length?(t=a[i],o=ee(t,e),e.log("process observer #".concat(t.index," derived: ").concat(t.derivedIdStr),o),[4,o]):[3,4];case 2:u.sent(),u.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}function ne(n,e){if(e){var r=Date.now();e.then(function(a){var t=Date.now()-r,o=typeof n=="function"?n(a):n;console.log(o+"(".concat(t,"ms)"))}).catch(function(){})}else{var i=typeof n=="function"?n(null):n;console.log(i)}}function te(n){return P(this,arguments,void 0,function(e,r){var i,a,t,o,u,l,s,c,f,g,d,v,m,p,w;return r===void 0&&(r={}),k(this,function(h){switch(h.label){case 0:if(i=e.baseURL,a="",r.distPath)a=y.resolve(process.cwd(),r.distPath);else for(a=y.resolve(process.cwd(),(l=e.workCode)!==null&&l!==void 0?l:"work-".concat(Date.now()));q.existsSync(a);)/.-(\d+)$/.test(a)?a=a.replace(/.-(\d+)$/,function(L,j){return"-"+(Number(j)+1)}):a=a+"-1";return t={baseURL:i,distPath:a,fetch:(s=r.fetch)!==null&&s!==void 0?s:fetch,imageOptions:{size:(f=(c=r.imageOptions)===null||c===void 0?void 0:c.size)!==null&&f!==void 0?f:[],format:(d=(g=r.imageOptions)===null||g===void 0?void 0:g.format)!==null&&d!==void 0?d:[]},textureOptions:{size:(m=(v=r.textureOptions)===null||v===void 0?void 0:v.size)!==null&&m!==void 0?m:[],format:(w=(p=r.textureOptions)===null||p===void 0?void 0:p.format)!==null&&w!==void 0?w:[]},log:r.log?ne:(function(){return Promise.resolve()}),imageProcessingFilename:r.imageProcessingFilename},t.log(JSON.stringify(t,null," ")),[4,N.mkdir(a,{recursive:!0})];case 1:return h.sent(),o="work.json",u=y.resolve(a,o),[4,N.writeFile(u,JSON.stringify(e.toJSON(),null," "))];case 2:return h.sent(),[4,re(e,t)];case 3:return h.sent(),[4,Z(e,t)];case 4:return h.sent(),[2]}})})}exports.download=te;
255
+ */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("node:fs"),B=require("node:fs/promises"),L=require("node:path"),K=require("node:stream"),Q=require("sharp");function S(n,r,e,i){function a(t){return t instanceof e?t:new e(function(u){u(t)})}return new(e||(e=Promise))(function(t,u){function o(c){try{s(i.next(c))}catch(f){u(f)}}function l(c){try{s(i.throw(c))}catch(f){u(f)}}function s(c){c.done?t(c.value):a(c.value).then(o,l)}s((i=i.apply(n,r||[])).next())})}function F(n,r){var e={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,a,t,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=o(0),u.throw=o(1),u.return=o(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function o(s){return function(c){return l([s,c])}}function l(s){if(i)throw new TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(e=0)),e;)try{if(i=1,a&&(t=s[0]&2?a.return:s[0]?a.throw||((t=a.return)&&t.call(a),0):a.next)&&!(t=t.call(a,s[1])).done)return t;switch(a=0,t&&(s=[s[0]&2,t.value]),s[0]){case 0:case 1:t=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,a=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(t=e.trys,!(t=t.length>0&&t[t.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!t||s[1]>t[0]&&s[1]<t[3])){e.label=s[1];break}if(s[0]===6&&e.label<t[1]){e.label=t[1],t=s;break}if(t&&e.label<t[2]){e.label=t[2],e.ops.push(s);break}t[2]&&e.ops.pop(),e.trys.pop();continue}s=r.call(n,e)}catch(c){s=[6,c],a=0}finally{i=t=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function O(n,r){if(r&&r[r.length-1]!=="/"&&(r+="/"),n.length>r.length&&n.startsWith(r))return n.slice(r.length);throw new Error("".concat(n," is not starting with ").concat(r))}function V(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var e=[];n=n.map(function(o){return(o!=null?o:"").trim()}).filter(function(o){return o.length>0&&!/^\/+$/.test(o)});for(var i=0;i<n.length;i++){var a=i===0,t=i===n.length-1,u=n[i];a||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),t||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}var Y=1024*1024*5;function T(n,r,e){return S(this,void 0,void 0,function(){var i,a,t,u;return F(this,function(o){switch(o.label){case 0:return q.existsSync(r)?[2,r]:[4,e(n)];case 1:return i=o.sent(),i.ok&&i.body?[4,B.mkdir(L.dirname(r),{recursive:!0})]:[3,6];case 2:return o.sent(),a=Number((u=i.headers.get("content-length"))!==null&&u!==void 0?u:"Infinity"),a>Y?[2,new Promise(function(l,s){var c=K.Readable.fromWeb(i.body),f=q.createWriteStream(r);c.pipe(f),c.on("error",s),f.on("finish",function(){return l(r)})})]:[3,3];case 3:return[4,i.arrayBuffer()];case 4:return t=o.sent(),[4,B.writeFile(r,Buffer.from(t))];case 5:return o.sent(),[2,r];case 6:throw new Error("url: ".concat(n,"(").concat(i.statusText,")"))}})})}var Z=["jpg","png"];function G(n,r){var e=L.extname(n).slice(1)||"jpg",i=r.cut,a=r.size,t=r.format,u=t===void 0?e:t,o="";if(r.toFilename)o=r.toFilename(n,{cut:r.cut,size:r.size,format:r.format});else{var l="",s="",c=u;i&&(l=i.join("x")),a&&(s="".concat(a,"x")),c===e&&!s&&!l&&(c=""),o=[n,l,s,c].filter(function(f){return f.length>0}).join(".")}return o}function C(n,r){return S(this,void 0,void 0,function(){var e,i,a,t,u,o,l,s,c;return F(this,function(f){return e=L.extname(n).slice(1)||"jpg",i=r.cut,a=r.size,t=r.format,u=t===void 0?e:t,o=n,(i||a)&&u!==e&&Z.includes(u)&&(l=G(n,{format:u,toFilename:r.toFilename}),l!==o&&q.existsSync(l)&&(o=l)),s=Q(o),i&&(s=s.extract({left:i[0],top:i[1],width:i[2],height:i[3]})),a&&(s=s.resize(a)),u&&(s=s.toFormat(u)),c=G(n,r),c!==n&&!q.existsSync(c)?[2,s.toFile(c).then(function(){return c})]:[2,c]})})}function X(n){var r=[];if(n.content&&(n.content.uri?r.push(n.content.uri):n.content.url&&r.push(n.content.url)),n.children)for(var e=0,i=n.children;e<i.length;e++){var a=i[e],t=X(a);t.length>0&&r.push.apply(r,t)}return r}function x(n,r,e){return S(this,void 0,void 0,function(){var i,a,t;return F(this,function(u){switch(u.label){case 0:return i=new URL(n,r).href,a=L.join(e.distPath,O(i,e.baseURL)),t=T(i,a,e.fetch),e.log(function(o){return"download: ".concat(i," -> ").concat(o)},t),[4,t];case 1:return u.sent(),/\.json$/.test(n)?[4,H(i,e)]:[3,3];case 2:u.sent(),u.label=3;case 3:return[2]}})})}function H(n,r){return S(this,void 0,void 0,function(){var e,i,a,t,u,o,l,s,c,f,v,m,p,b,w,h,d,y,k;return F(this,function(g){switch(g.label){case 0:return e=L.join(r.distPath,O(n,r.baseURL)),i=T(n,e,r.fetch),r.log(function(z){return"download: ".concat(n," -> ").concat(z)},i),[4,i];case 1:return g.sent(),u=(t=JSON).parse,[4,B.readFile(e,"utf8")];case 2:return a=u.apply(t,[g.sent()]),a.asset.overview?(o=new URL(a.asset.overview.imageFile,n).href,l=L.join(r.distPath,O(o,r.baseURL)),s=T(o,l,r.fetch),r.log(function(z){return"download: ".concat(o," -> ").concat(z)},s),[4,s]):[3,4];case 3:g.sent(),g.label=4;case 4:if(!a.asset.trajectories)return[3,8];c=function(z){var j,P,R;return F(this,function(U){switch(U.label){case 0:return j=new URL(z.file,n).href,P=L.join(r.distPath,O(j,r.baseURL)),R=T(j,P,r.fetch),r.log(function(_){return"download: ".concat(j," -> ").concat(_)},R),[4,R];case 1:return U.sent(),[2]}})},f=0,v=a.asset.trajectories.list,g.label=5;case 5:return f<v.length?(m=v[f],[5,c(m)]):[3,8];case 6:g.sent(),g.label=7;case 7:return f++,[3,5];case 8:p=X(a.root),b=6,w=0,g.label=9;case 9:if(!(w<p.length))return[3,12];for(h=[],d=0;d<b;d++)y=p[w+d],y&&(k=x(y,n,r),h.push(k));return[4,Promise.all(h)];case 10:g.sent(),g.label=11;case 11:return w+=b,[3,9];case 12:return[2]}})})}function ee(n,r){return S(this,void 0,void 0,function(){var e,i,a,t,u,h,o,l,s,c,f,v,m,p,b,w,h;return F(this,function(d){switch(d.label){case 0:return r.log("process model"),n.model?(e=n.model,i=e.textures,a=e.layers,t=e.file,u=e.textureBase,t?(r.log("process model file"),h=n.getURL(t),o=L.join(r.distPath,O(h,r.baseURL)),l=T(h,o,r.fetch),r.log(function(y){return"download: ".concat(t," -> ").concat(y)},l),[4,l]):[3,5]):[3,9];case 1:if(d.sent(),!i)return[3,5];s=function(y){var k,g,z,j,P,R,U,_,E,$,J,A,D;return F(this,function(M){switch(M.label){case 0:return k=V(n.getURL(u!=null?u:""),y),g=L.join(r.distPath,O(k,r.baseURL)),z=T(k,g,r.fetch),r.log(function(W){return"download: ".concat(k," -> ").concat(W)},z),[4,z];case 1:for(M.sent(),j=r.imageOptions.format,j.length===0&&j.push(void 0),P=r.imageOptions.size,P.length===0&&P.push(void 0),R=[],U=0,_=j;U<_.length;U++)for(E=_[U],$=0,J=P;$<J.length;$++)A=J[$],D=C(g,{format:E,size:A,toFilename:r.imageProcessingFilename}),r.log(function(W){return"imageProcessing: ".concat(g," -> ").concat(W)},D),R.push(D);return[4,Promise.all(R)];case 2:return M.sent(),[2]}})},c=0,f=i,d.label=2;case 2:return c<f.length?(v=f[c],[5,s(v)]):[3,5];case 3:d.sent(),d.label=4;case 4:return c++,[3,2];case 5:if(!a)return[3,9];m=0,p=a,d.label=6;case 6:return m<p.length?(b=p[m],w=b.tileset,r.log("process model layer"),h=n.getURL(w),[4,H(h,r)]):[3,9];case 7:d.sent(),d.label=8;case 8:return m++,[3,6];case 9:return[2]}})})}function N(n,r,e){return S(this,void 0,void 0,function(){var i,a,t,u,o,l,s,c,f,v,m,p,b,w;return F(this,function(h){switch(h.label){case 0:return i=L.join(e.distPath,O(n,e.baseURL)),a=T(n,i,e.fetch),e.log(function(d){return"download: ".concat(n," -> ").concat(d)},a),[4,a];case 1:if(h.sent(),t=Math.pow(2,r.level),u=e.imageOptions.format,u.length===0&&u.push(void 0),o=[],t>1)for(l=0;l<t;l++)for(s=0;s<t;s++)for(c=0,f=u;c<f.length;c++)v=f[c],m=[r.size/t*s,r.size/t*l,r.size/t,r.size/t],p=r.scale>=1?void 0:r.scale*r.size/t,b=C(i,{format:v,size:p,cut:m,toFilename:e.imageProcessingFilename}),e.log(function(d){return"imageProcessing: ".concat(i," -> ").concat(d)},b),o.push(b),r.level===1&&r.scale>=.5&&(v==="jpg"||/\.jpg$/.test(i))&&(w=C(i,{format:v,size:void 0,cut:m,toFilename:e.imageProcessingFilename}),e.log(function(d){return"imageProcessing: ".concat(i," -> ").concat(d)},w),o.push(w));return[4,Promise.all(o)];case 2:return h.sent(),[2]}})})}function re(n,r){return S(this,void 0,void 0,function(){return F(this,function(e){switch(e.label){case 0:return[4,Promise.all([N(n.work.getURL(n.front),n,r),N(n.work.getURL(n.back),n,r),N(n.work.getURL(n.left),n,r),N(n.work.getURL(n.right),n,r),N(n.work.getURL(n.up),n,r),N(n.work.getURL(n.down),n,r)])];case 1:return e.sent(),[2]}})})}function I(n,r,e){return S(this,void 0,void 0,function(){var i,a,t,u,o,l,s,c,f,v,m,p,b,w,h,d;return F(this,function(y){switch(y.label){case 0:return i=L.join(e.distPath,O(n,e.baseURL)),a=T(n,i,e.fetch),e.log(function(k){return"download: ".concat(n," -> ").concat(k)},a),[4,a];case 1:y.sent(),t=e.imageOptions.format,t.length===0&&t.push(void 0),u=e.imageOptions.size,u.length===0&&u.push(void 0),o=function(k){var g,z,j,P,R,U,_;return F(this,function(E){switch(E.label){case 0:return g=n.replace(/cube\_\d+/,"cube_".concat(k)),z=L.join(e.distPath,O(g,e.baseURL)),j=T(g,z,e.fetch),e.log(function($){return"download ".concat(g," -> ").concat(z)},j),[4,j];case 1:E.sent(),P=0,R=t,E.label=2;case 2:return P<R.length?(U=R[P],_=C(z,{format:U,toFilename:e.imageProcessingFilename}),e.log(function($){return"imageProcessing: ".concat(z," -> ").concat($)},_),[4,_]):[3,5];case 3:E.sent(),E.label=4;case 4:return P++,[3,2];case 5:return[2]}})},l=0,s=r,y.label=2;case 2:return l<s.length?(c=s[l],[5,o(c)]):[3,5];case 3:y.sent(),y.label=4;case 4:return l++,[3,2];case 5:for(f=[],v=0,m=t;v<m.length;v++)for(p=m[v],b=0,w=u;b<w.length;b++)h=w[b],d=C(i,{format:p,size:h,toFilename:e.imageProcessingFilename}),e.log(function(k){return"imageProcessing: ".concat(i," -> ").concat(k)},d),f.push(d);return[4,Promise.all(f)];case 6:return y.sent(),[2]}})})}function ne(n,r){return S(this,void 0,void 0,function(){var e;return F(this,function(i){switch(i.label){case 0:return e=n.images,[4,Promise.all([I(e.work.getURL(e.front),e.sizeList,r),I(e.work.getURL(e.back),e.sizeList,r),I(e.work.getURL(e.left),e.sizeList,r),I(e.work.getURL(e.right),e.sizeList,r),I(e.work.getURL(e.up),e.sizeList,r),I(e.work.getURL(e.down),e.sizeList,r)])];case 1:return i.sent(),e.tiles?[4,Promise.all(e.tiles.map(function(a){return re(a,r)}))]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})}function te(n,r){return S(this,void 0,void 0,function(){var e,i,a,t,u;return F(this,function(o){switch(o.label){case 0:e=n.observers,i=0,a=e,o.label=1;case 1:return i<a.length?(t=a[i],u=ne(t,r),r.log("process observer #".concat(t.index," derived: ").concat(t.derivedIdStr),u),[4,u]):[3,4];case 2:o.sent(),o.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}function ie(n,r){if(r){var e=Date.now();r.then(function(a){var t=Date.now()-e,u=typeof n=="function"?n(a):n;console.log(u+"(".concat(t,"ms)"))}).catch(function(){})}else{var i=typeof n=="function"?n(null):n;console.log(i)}}function ae(n){return S(this,arguments,void 0,function(r,e){var i,a,t,u,o,l,s,c,f,v,m,p,b,w,h;return e===void 0&&(e={}),F(this,function(d){switch(d.label){case 0:if(i=r.baseURL,a="",e.distPath)a=L.resolve(process.cwd(),e.distPath);else for(a=L.resolve(process.cwd(),(l=r.workCode)!==null&&l!==void 0?l:"work-".concat(Date.now()));q.existsSync(a);)/.-(\d+)$/.test(a)?a=a.replace(/.-(\d+)$/,function(y,k){return"-"+(Number(k)+1)}):a=a+"-1";return t={baseURL:i,distPath:a,fetch:(s=e.fetch)!==null&&s!==void 0?s:fetch,imageOptions:{size:(f=(c=e.imageOptions)===null||c===void 0?void 0:c.size)!==null&&f!==void 0?f:[],format:(m=(v=e.imageOptions)===null||v===void 0?void 0:v.format)!==null&&m!==void 0?m:[]},textureOptions:{size:(b=(p=e.textureOptions)===null||p===void 0?void 0:p.size)!==null&&b!==void 0?b:[],format:(h=(w=e.textureOptions)===null||w===void 0?void 0:w.format)!==null&&h!==void 0?h:[]},log:e.log?ie:(function(){return Promise.resolve()}),imageProcessingFilename:e.imageProcessingFilename},t.log(JSON.stringify(t,null," ")),[4,B.mkdir(a,{recursive:!0})];case 1:return d.sent(),u="work.json",o=L.resolve(a,u),[4,B.writeFile(o,JSON.stringify(r.toJSON(),null," "))];case 2:return d.sent(),[4,te(r,t)];case 3:return d.sent(),[4,ee(r,t)];case 4:return d.sent(),[2]}})})}exports.download=ae;