1 line
3.6 KiB
JavaScript
1 line
3.6 KiB
JavaScript
function n(t){function e(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var t=n.done;return Promise.resolve(n.value).then(function(n){return{value:n,done:t}})}return n=function(n){this.s=n,this.n=n.next},n.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(n){var t=this.s.return;return void 0===t?Promise.resolve({value:n,done:!0}):e(t.apply(this.s,arguments))},throw:function(n){var t=this.s.return;return void 0===t?Promise.reject(n):e(t.apply(this.s,arguments))}},new n(t)}function t(n,e,i){if(!n.s){if(i instanceof r){if(!i.s)return void(i.o=t.bind(null,n,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,n,e),t.bind(null,n,2));n.s=e,n.v=i;var o=n.o;o&&o(n)}}var e=function e(u,c,f,h){try{var s=function(n){return Promise.resolve(Promise.all(v)).then(function(n){var t=n.flat();return Promise.resolve(Promise.all(l)).then(function(n){return[].concat(t,n)})})};void 0===f&&(f=u.name);var a,v=[],l=[],d=!1,y=!1,b=o(function(){return function(o,s){try{var a=function(){var o,s=function(t){var e,r,i,o=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(r&&null!=(e=t[r]))return e.call(t);if(i&&null!=(e=t[i]))return new n(e.call(t));r="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(u.values()),a=function(n,e,o){for(var u;;){var c=n();if(i(c)&&(c=c.v),!c)return f;if(c.then){u=0;break}var f=o();if(f&&f.then){if(!i(f)){u=1;break}f=f.s}if(e){var h=e();if(h&&h.then&&!i(h)){u=2;break}}}var s=new r,a=t.bind(null,s,2);return(0===u?c.then(l):1===u?f.then(v):h.then(d)).then(void 0,a),s;function v(r){f=r;do{if(e&&(h=e())&&h.then&&!i(h))return void h.then(d).then(void 0,a);if(!(c=n())||i(c)&&!c.v)return void t(s,1,f);if(c.then)return void c.then(l).then(void 0,a);i(f=o())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,a)}function l(n){n?(f=o())&&f.then?f.then(v).then(void 0,a):v(f):t(s,1,f)}function d(){(c=n())?c.then?c.then(l).then(void 0,a):l(c):t(s,1,f)}}(function(){return Promise.resolve(s.next()).then(function(n){return d=!(o=n).done})},function(){return!!(d=!1)},function(){var n=o.value,t=f+"/"+n.name;"file"===n.kind?l.push(n.getFile().then(function(e){return e.directoryHandle=u,e.handle=n,Object.defineProperty(e,"webkitRelativePath",{configurable:!0,enumerable:!0,get:function(){return t}})})):"directory"!==n.kind||!c||h&&h(n)||v.push(e(n,c,t,h))});if(a&&a.then)return a.then(function(){})}()}catch(n){return s(n)}return a&&a.then?a.then(void 0,s):a}(0,function(n){y=!0,a=n})},function(n,t){function e(e){if(n)throw t;return t}var r=o(function(){var n=function(){if(d&&null!=_iterator.return)return Promise.resolve(_iterator.return()).then(function(){})}();if(n&&n.then)return n.then(function(){})},function(n,t){if(y)throw a;if(n)throw t;return t});return r&&r.then?r.then(e):e()});return Promise.resolve(b&&b.then?b.then(s):s())}catch(n){return Promise.reject(n)}};const r=/*#__PURE__*/function(){function n(){}return n.prototype.then=function(e,r){const i=new n,o=this.s;if(o){const n=1&o?e:r;if(n){try{t(i,1,n(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{const o=n.v;1&n.s?t(i,1,e?e(o):o):r?t(i,1,r(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function i(n){return n instanceof r&&1&n.s}function o(n,t){try{var e=n()}catch(n){return t(!0,n)}return e&&e.then?e.then(t.bind(null,!1),t.bind(null,!0)):t(!1,e)}exports.default=function(n){void 0===n&&(n={});try{return n.recursive=n.recursive||!1,Promise.resolve(window.showDirectoryPicker({id:n.id,startIn:n.startIn})).then(function(t){return e(t,n.recursive,void 0,n.skipDirectory)})}catch(n){return Promise.reject(n)}};
|