0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-12-23 04:30:11 +09:00
yude.jp/dist/worker.js

1 line
43 KiB
JavaScript
Raw Normal View History

2021-02-05 16:22:07 +09:00
!function(a){var i={};function p(t){if(i[t])return i[t].exports;var n=i[t]={i:t,l:!1,exports:{}};return a[t].call(n.exports,n,n.exports,p),n.l=!0,n.exports}p.m=a,p.c=i,p.d=function(a,i,t){p.o(a,i)||Object.defineProperty(a,i,{enumerable:!0,get:t})},p.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},p.t=function(a,i){if(1&i&&(a=p(a)),8&i)return a;if(4&i&&"object"==typeof a&&a&&a.__esModule)return a;var t=Object.create(null);if(p.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:a}),2&i&&"string"!=typeof a)for(var n in a)p.d(t,n,function(i){return a[i]}.bind(null,n));return t},p.n=function(a){var i=a&&a.__esModule?function(){return a.default}:function(){return a};return p.d(i,"a",i),i},p.o=function(a,i){return Object.prototype.hasOwnProperty.call(a,i)},p.p="",p(p.s=1)}([function(a,i,p){"use strict";var t=this&&this.__awaiter||function(a,i,p,t){return new(p||(p=Promise))((function(n,o){function e(a){try{c(t.next(a))}catch(a){o(a)}}function l(a){try{c(t.throw(a))}catch(a){o(a)}}function c(a){var i;a.done?n(a.value):(i=a.value,i instanceof p?i:new p((function(a){a(i)}))).then(e,l)}c((t=t.apply(a,i||[])).next())}))},n=this&&this.__generator||function(a,i){var p,t,n,o,e={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(p)throw new TypeError("Generator is already executing.");for(;e;)try{if(p=1,t&&(n=2&o[0]?t.return:o[0]?t.throw||((n=t.return)&&n.call(t),0):t.next)&&!(n=n.call(t,o[1])).done)return n;switch(t=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,t=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(!(n=e.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){e=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){e.label=o[1];break}if(6===o[0]&&e.label<n[1]){e.label=n[1],n=o;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(o);break}n[2]&&e.ops.pop(),e.trys.pop();continue}o=i.call(a,e)}catch(a){o=[6,a],t=0}finally{p=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}};Object.defineProperty(i,"__esModule",{value:!0});var o=p(2),e=p(6);i.MethodNotAllowedError=e.MethodNotAllowedError,i.NotFoundError=e.NotFoundError,i.InternalError=e.InternalError;var l=function(a){var i=new URL(a.url),p=i.pathname;return p.endsWith("/")?p=p.concat("index.html"):o.getType(p)||(p=p.concat("/index.html")),i.pathname=p,new Request(i.toString(),a)};i.mapRequestToAsset=l,i.serveSinglePageApp=function(a){a=l(a);var i=new URL(a.url);return i.pathname.endsWith(".html")?new Request(i.origin+"/index.html",a):a};var c={browserTTL:null,edgeTTL:172800,bypassCache:!1};i.getAssetFromKV=function(a,i){return t(void 0,void 0,void 0,(function(){var p,t,s,d,m,r,v,x,u,f,g,h,b,w,k,y,j,z;return n(this,(function(n){switch(n.label){case 0:if(i=Object.assign({ASSET_NAMESPACE:__STATIC_CONTENT,ASSET_MANIFEST:__STATIC_CONTENT_MANIFEST,mapRequestToAsset:l,cacheControl:c},i),p=a.request,t=i.ASSET_NAMESPACE,s="string"==typeof i.ASSET_MANIFEST?JSON.parse(i.ASSET_MANIFEST):i.ASSET_MANIFEST,void 0===t)throw new e.InternalError("there is no KV namespace bound to the script");if(!["GET","HEAD"].includes(p.method))throw new e.MethodNotAllowedError(p.method+" is not a valid request method");return d=new URL(p.url).pathname.replace(/^\/+/,""),m=!1,s[d]?r=p:s[decodeURIComponent(d)]?(m=!0,r=p):r=i.mapRequestToAsset(p),v=new URL(r.url),x=m?decodeURIComponent(v.pathname):v.pathname,u=x.replace(/^\/+/,""),f=caches.default,(g=o.getType(u)||"text/plain").startsWith("text")&&(g+="; charset=utf8"),h=!1,void 0!==s&&s[u]&&(u=s[u],h=!0),b=new Request(v.origin+"/"+u,p),w=function(){switch(typeof i.cacheControl){case"function":return i.cacheControl(p);case"object":return i.cacheControl;default:return c}}(),i.cacheControl=Object.assign({},c,w),(i.cacheCont