diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 148b489..0000000 --- a/.eslintignore +++ /dev/null @@ -1,65 +0,0 @@ -dist/* - -# !include:.gitignore - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - -# next.js build output -.next diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index d45d0f9..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "env": { - "es2020": true, - "node": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:regexp/recommended", - "prettier" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 10, - "sourceType": "module" - }, - "plugins": ["@typescript-eslint"], - "rules": { - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "default", - "format": ["camelCase"] - }, - { - "selector": "typeLike", - "format": ["PascalCase"] - } - ] - } -} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce4a98c..c4b1535 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,14 +12,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version-file: ".node-version" - cache: "npm" - - run: npm ci - - run: npm audit signatures - - run: npm run build - - run: npm run test + cache: "pnpm" + - run: pnpm install --frozen-lockfile + - run: pnpm run build + - run: pnpm run test - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.husky/pre-commit b/.husky/pre-commit index d6cb288..0c958d2 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npm run build +pnpm run build diff --git a/.prettierrc.json b/.prettierrc.json index cce9d3c..0967ef4 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,3 +1 @@ -{ - "semi": false -} +{} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e4197a..54bb41f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,14 +18,16 @@ Pull Requests are always welcome, but please discuss larger changes via issue be 1. Fork the repository. 1. Clone the fork to your local machine -1. Install the dependencies with npm - `npm install` +1. Enable corepack + `corepack enable` +1. Install the dependencies with pnpm + `pnpm install` 1. Create a new topic branch `git checkout -b fix/topic` 1. Make changes 1. Run build & test - `npm run build` - `npm run test` + `pnpm run build` + `pnpm run test` 1. commit and push `git push -u origin HEAD` 1. make a Pull Request. diff --git a/dist/index.js b/dist/index.js index 4291a38..b429498 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -require('./sourcemap-register.js');(()=>{var e={8:e=>{var t=/<%=([\s\S]+?)%>/g;e.exports=t},417:(e,t,r)=>{e=r.nmd(e);var n=r(8),s=r(477);var o=800,i=16;var a=1/0,u=9007199254740991;var c="[object Arguments]",l="[object Array]",f="[object AsyncFunction]",p="[object Boolean]",m="[object Date]",d="[object DOMException]",y="[object Error]",b="[object Function]",g="[object GeneratorFunction]",v="[object Map]",_="[object Number]",h="[object Null]",j="[object Object]",w="[object Proxy]",T="[object RegExp]",C="[object Set]",O="[object String]",K="[object Symbol]",S="[object Undefined]",R="[object WeakMap]";var x="[object ArrayBuffer]",I="[object DataView]",M="[object Float32Array]",P="[object Float64Array]",A="[object Int8Array]",F="[object Int16Array]",k="[object Int32Array]",E="[object Uint8Array]",G="[object Uint8ClampedArray]",q="[object Uint16Array]",L="[object Uint32Array]";var $=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var D=/[\\^$.*+?()[\]{}|]/g;var N=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var V=/^\[object .+?Constructor\]$/;var B=/^(?:0|[1-9]\d*)$/;var z=/($^)/;var J=/['\n\r\u2028\u2029\\]/g;var W={};W[M]=W[P]=W[A]=W[F]=W[k]=W[E]=W[G]=W[q]=W[L]=true;W[c]=W[l]=W[x]=W[p]=W[I]=W[m]=W[y]=W[b]=W[v]=W[_]=W[j]=W[T]=W[C]=W[O]=W[R]=false;var Q={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var X=typeof global=="object"&&global&&global.Object===Object&&global;var Y=typeof self=="object"&&self&&self.Object===Object&&self;var Z=X||Y||Function("return this")();var ee=true&&t&&!t.nodeType&&t;var te=ee&&"object"=="object"&&e&&!e.nodeType&&e;var re=te&&te.exports===ee;var ne=re&&X.process;var se=function(){try{var e=te&&te.require&&te.require("util").types;if(e){return e}return ne&&ne.binding&&ne.binding("util")}catch(e){}}();var oe=se&&se.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayMap(e,t){var r=-1,n=e==null?0:e.length,s=Array(n);while(++r1?r[s-1]:undefined,i=s>2?r[2]:undefined;o=e.length>3&&typeof o=="function"?(s--,o):undefined;if(i&&isIterateeCall(r[0],r[1],i)){o=s<3?undefined:o;s=1}t=Object(t);while(++n-1&&e%1==0&&e0){if(++t>=o){return arguments[0]}}else{t=0}return e.apply(undefined,arguments)}}function toSource(e){if(e!=null){try{return ce.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eq(e,t){return e===t||e!==e&&t!==t}var xe=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&le.call(e,"callee")&&!ve.call(e,"callee")};var Ie=Array.isArray;function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}var Me=je||stubFalse;function isError(e){if(!isObjectLike(e)){return false}var t=baseGetTag(e);return t==y||t==d||typeof e.message=="string"&&typeof e.name=="string"&&!isPlainObject(e)}function isFunction(e){if(!isObject(e)){return false}var t=baseGetTag(e);return t==b||t==g||t==f||t==w}function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=u}function isObject(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function isObjectLike(e){return e!=null&&typeof e=="object"}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=j){return false}var t=ge(e);if(t===null){return true}var r=le.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ce.call(r)==me}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==K}var Pe=oe?baseUnary(oe):baseIsTypedArray;function toString(e){return e==null?"":baseToString(e)}var Ae=createAssigner((function(e,t,r,n){copyObject(t,keysIn(t),e,n)}));function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,true):baseKeysIn(e)}function template(e,t,r){var o=s.imports._.templateSettings||s;if(r&&isIterateeCall(e,t,r)){t=undefined}e=toString(e);t=Ae({},t,o,customDefaultsAssignIn);var i=Ae({},t.imports,o.imports,customDefaultsAssignIn),a=keys(i),u=baseValues(i,a);var c,l,f=0,p=t.interpolate||z,m="__p += '";var d=RegExp((t.escape||z).source+"|"+p.source+"|"+(p===n?N:z).source+"|"+(t.evaluate||z).source+"|$","g");var y=le.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";e.replace(d,(function(t,r,n,s,o,i){n||(n=s);m+=e.slice(f,i).replace(J,escapeStringChar);if(r){c=true;m+="' +\n__e("+r+") +\n'"}if(o){l=true;m+="';\n"+o+";\n__p += '"}if(n){m+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"}f=i+t.length;return t}));m+="';\n";var b=le.call(t,"variable")&&t.variable;if(!b){m="with (obj) {\n"+m+"\n}\n"}m=(l?m.replace($,""):m).replace(U,"$1").replace(H,"$1;");m="function("+(b||"obj")+") {\n"+(b?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+m+"return __p\n}";var g=Fe((function(){return Function(a,y+"return "+m).apply(undefined,u)}));g.source=m;if(isError(g)){throw g}return g}var Fe=baseRest((function(e,t){try{return apply(e,undefined,t)}catch(e){return isError(e)?e:new Error(e)}}));function constant(e){return function(){return e}}function identity(e){return e}function stubFalse(){return false}e.exports=template},477:(e,t,r)=>{var n=r(8);var s=1/0;var o="[object Null]",i="[object Symbol]",a="[object Undefined]";var u=/[&<>"']/g,c=RegExp(u.source);var l=/<%-([\s\S]+?)%>/g,f=/<%([\s\S]+?)%>/g;var p={"&":"&","<":"<",">":">",'"':""","'":"'"};var m=typeof global=="object"&&global&&global.Object===Object&&global;var d=typeof self=="object"&&self&&self.Object===Object&&self;var y=m||d||Function("return this")();function arrayMap(e,t){var r=-1,n=e==null?0:e.length,s=Array(n);while(++r{"use strict";var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var __export=(e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,o,i,a)=>{if(o&&typeof o==="object"||typeof o==="function"){for(let u of n(o))if(!s.call(e,u)&&u!==i)t(e,u,{get:()=>o[u],enumerable:!(a=r(o,u))||a.enumerable})}return e};var __toCommonJS=e=>__copyProps(t({},"__esModule",{value:true}),e);var o={};__export(o,{Result:()=>a,prototype:()=>i});e.exports=__toCommonJS(o);function getOrThrow(){if(this.isSuccess)return this.value;throw this.error}function toUnion(){if(this.isSuccess)return this.value;return this.error}function ifSuccess(e){if(this.isFailure)return void 0;return e(this.value)}function ifFailure(e){if(this.isSuccess)return void 0;return e(this.error)}function match(e,t){if(this.isSuccess)return e(this.value);return t(this.error)}function map(e){if(this.isFailure)return this;return a.success(e(this.value))}function mapError(e){if(this.isSuccess)return this;return a.failure(e(this.error))}function flatMap(e){if(this.isFailure)return this;return e(this.value)}function flatten(){if(this.isFailure)return this;return this.value}function assertErrorInstanceOf(e){if(this.isSuccess)return this;if(this.error instanceof e)return this;throw new TypeError(`Assertion failed: Expected error to be an instance of ${e.name}.`)}var i={getOrThrow:getOrThrow,toUnion:toUnion,ifSuccess:ifSuccess,ifFailure:ifFailure,match:match,map:map,mapError:mapError,flatMap:flatMap,flatten:flatten,assertErrorInstanceOf:assertErrorInstanceOf};var a;(e=>{function success(e){return withPrototype({value:e,isSuccess:true,isFailure:false},i)}e.success=success;function failure(e){return withPrototype({error:e,isSuccess:false,isFailure:true},i)}e.failure=failure;function tryCatch(e){try{return success(e())}catch(e){return failure(e)}}e.tryCatch=tryCatch;async function fromPromise(e){try{return success(await e)}catch(e){return failure(e)}}e.fromPromise=fromPromise;function fromNullish(e){return e!=null?success(e):failure(e)}e.fromNullish=fromNullish;function all(e){const t=[];for(const r of e){if(r.isFailure)return r;t.push(r.value)}return success(t)}e.all=all})(a||(a={}));function withPrototype(e,t){return Object.assign(Object.create(t),e)}0&&0},755:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var s=Object.getOwnPropertyDescriptor(t,r);if(!s||("get"in s?!t.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,s)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))n(t,e,r);s(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.setFailed=t.endGroup=t.startGroup=t.info=void 0;const i=o(r(37));const a="::";var u;(function(e){e[e["success"]=0]="success";e[e["failure"]=1]="failure"})(u||(u={}));function info(e){process.stdout.write(e+i.EOL)}t.info=info;function startGroup(e){process.stdout.write(a+"group"+a+e+i.EOL)}t.startGroup=startGroup;function endGroup(){process.stdout.write(a+"endgroup"+a+i.EOL)}t.endGroup=endGroup;function setFailed(e){const t=e instanceof Error?e.toString():e;process.exitCode=u.failure;process.stdout.write(a+"error"+a+t+i.EOL)}t.setFailed=setFailed},399:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.main=void 0;const n=r(755);const s=r(410);const o=r(587);const i=r(526);const a=r(616);const runAction=async()=>{(0,n.startGroup)("設定を読み込み中");const{projectKey:e,apiHost:t,apiKey:r,githubEventPath:u,fixKeywords:c,closeKeywords:l,pushCommentTemplate:f,prOpenedCommentTemplate:p,prReopenedCommentTemplate:m,prReadyForReviewCommentTemplate:d,prClosedCommentTemplate:y,prMergedCommentTemplate:b,commitMessageRegTemplate:g,prTitleRegTemplate:v,fixStatusId:_,closeStatusId:h}=(0,o.getConfigs)();(0,n.endGroup)();(0,n.startGroup)("イベントを読み込み中");const{event:j}=(0,s.fetchEvent)({path:u});(0,n.endGroup)();if(j&&"commits"in j&&j.commits.length>0){return await(0,a.push)({event:j,projectKey:e,apiHost:t,apiKey:r,fixKeywords:c,closeKeywords:l,pushCommentTemplate:f,commitMessageRegTemplate:g,fixStatusId:_,closeStatusId:h})}if(j&&"pull_request"in j&&"number"in j){return await(0,i.pr)({event:j,projectKey:e,apiHost:t,apiKey:r,fixKeywords:c,closeKeywords:l,fixStatusId:_,closeStatusId:h,prOpenedCommentTemplate:p,prReopenedCommentTemplate:m,prReadyForReviewCommentTemplate:d,prClosedCommentTemplate:y,prMergedCommentTemplate:b,prTitleRegTemplate:v})}return"予期しないイベントでした。"};const main=async()=>{try{const e=await runAction();(0,n.info)(e)}catch(e){if(e instanceof Error){(0,n.setFailed)(e)}else{(0,n.setFailed)(String(e))}}(0,n.endGroup)()};t.main=main;(0,t.main)()},410:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.fetchEvent=void 0;const n=r(147);const fetchEvent=({path:e})=>{const t=(0,n.readFileSync)(e,"utf8");return{event:JSON.parse(t)}};t.fetchEvent=fetchEvent},587:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getMultilineInput=t.getConfigs=t.defaultConfigs=void 0;t.defaultConfigs={fixKeywords:["#fix","#fixes","#fixed"],closeKeywords:["#close","#closes","#closed"],pushCommentTemplate:"<%= commits[0].author.name %>さんが[<%= ref.name %>](<%= ref.url %>)にプッシュしました"+"\n"+"<% commits.forEach(commit=>{ %>"+"\n"+"+ [<%= commit.comment %>](<%= commit.url %>) (<% print(commit.id.slice(0, 7)) %>)"+"<% }); %>",prOpenedCommentTemplate:"<%= sender.login %>さんがプルリクエストを作成しました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prReopenedCommentTemplate:"<%= sender.login %>さんがプルリクエストを作成しました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prReadyForReviewCommentTemplate:"<%= sender.login %>さんがプルリクエストを作成しました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prClosedCommentTemplate:"<%= sender.login %>さんがプルリクエストをクローズしました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prMergedCommentTemplate:"<%= sender.login %>さんがプルリクエストをマージしました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",commitMessageRegTemplate:"^"+"(<%= projectKey %>\\-\\d+)\\s?"+"(.*?)?\\s?"+"(<% print(fixKeywords.join('|')) %>|<% print(closeKeywords.join('|')) %>)?"+"$",prTitleRegTemplate:"^"+"(<%= projectKey %>\\-\\d+)\\s?"+"(.*?)?\\s?"+"(<% print(fixKeywords.join('|')) %>|<% print(closeKeywords.join('|')) %>)?"+"$",fixStatusId:"3",closeStatusId:"4"};const getConfigs=()=>({projectKey:getConfig("project_key",{required:true}),apiHost:getConfig("api_host",{required:true}),apiKey:getConfig("api_key",{required:true}),githubEventPath:getConfig("github_event_path",{required:true}),fixKeywords:getConfig("fix_keywords")?getMultilineInput("fix_keywords"):t.defaultConfigs.fixKeywords,closeKeywords:getConfig("close_keywords")?getMultilineInput("close_keywords"):t.defaultConfigs.closeKeywords,pushCommentTemplate:getConfig("push_comment_template")||t.defaultConfigs.pushCommentTemplate,prOpenedCommentTemplate:getConfig("pr_opened_comment_template")||t.defaultConfigs.prOpenedCommentTemplate,prReopenedCommentTemplate:getConfig("pr_reopened_comment_template")||t.defaultConfigs.prReopenedCommentTemplate,prReadyForReviewCommentTemplate:getConfig("pr_ready_for_review_comment_template")||t.defaultConfigs.prReadyForReviewCommentTemplate,prClosedCommentTemplate:getConfig("pr_closed_comment_template")||t.defaultConfigs.prClosedCommentTemplate,prMergedCommentTemplate:getConfig("pr_merged_comment_template")||t.defaultConfigs.prMergedCommentTemplate,commitMessageRegTemplate:getConfig("commit_message_reg_template")||t.defaultConfigs.commitMessageRegTemplate,prTitleRegTemplate:getConfig("pr_title_reg_template")||t.defaultConfigs.prTitleRegTemplate,fixStatusId:getConfig("fix_status_id")||t.defaultConfigs.fixStatusId,closeStatusId:getConfig("close_status_id")||t.defaultConfigs.closeStatusId});t.getConfigs=getConfigs;const getConfig=(e,t={})=>{const r=e.toUpperCase();const n=process.env[`INPUT_${r}`];const s=process.env[r];const o=n||s||"";if(t.required&&!o){throw new Error(`Input required and not supplied: ${e}`)}return o.trim()};function getMultilineInput(e,t={}){const r=getConfig(e,t).split("\n").filter((e=>e!==""));return r.map((e=>e.trim()))}t.getMultilineInput=getMultilineInput},526:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.pr=void 0;const n=r(755);const s=r(300);const o=r(332);const pr=async({event:e,projectKey:t,fixKeywords:r,closeKeywords:i,fixStatusId:a,closeStatusId:u,apiHost:c,apiKey:l,prOpenedCommentTemplate:f,prReopenedCommentTemplate:p,prReadyForReviewCommentTemplate:m,prClosedCommentTemplate:d,prMergedCommentTemplate:y,prTitleRegTemplate:b})=>{(0,n.startGroup)("プルリクエストを取得中");const{parsedPullRequest:g}=(0,s.parsePullRequest)({event:e,projectKey:t,fixKeywords:r,closeKeywords:i,prTitleRegTemplate:b});if(!g){return"課題キーのついたプルリクエストが見つかりませんでした。"}(0,n.endGroup)();(0,n.startGroup)("コメント送信中");const v=await(0,o.postComments)({parsedPullRequest:g,fixStatusId:a,closeStatusId:u,prOpenedCommentTemplate:f,prReopenedCommentTemplate:p,prReadyForReviewCommentTemplate:m,prClosedCommentTemplate:d,prMergedCommentTemplate:y,apiHost:c,apiKey:l});if(v.isFailure){return v.error}(0,n.startGroup)(`${g.issueKey}:`);(0,n.info)(g.title);if(g.isFix){(0,n.info)(`${g.issueKey}を処理済みにしました。`)}if(g.isClose){(0,n.info)(`${g.issueKey}を完了にしました。`)}(0,n.endGroup)();(0,n.endGroup)();return"正常に送信しました。"};t.pr=pr},300:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parsePullRequest=void 0;const s=n(r(417));const parsePullRequest=({event:e,projectKey:t,fixKeywords:r,closeKeywords:n,prTitleRegTemplate:o})=>{const i=RegExp((0,s.default)(o)({projectKey:t,fixKeywords:r,closeKeywords:n}),"s");const a=e.pull_request.title.match(i);const[,u=null,c="",l=""]=a??[];if(!a||!u){return{parsedPullRequest:null}}return{parsedPullRequest:{pr:e.pull_request,action:e.action,sender:e.sender,issueKey:u,title:c,keywords:l,isFix:r.includes(l),isClose:n.includes(l)}}};t.parsePullRequest=parsePullRequest},332:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.postComments=void 0;const s=r(41);const o=r(310);const i=n(r(417));const a=(0,i.default)("https://<%=apiHost%>/api/v2/issues/<%=issueKey%>?apiKey=<%=apiKey%>");const postComments=async({parsedPullRequest:e,fixStatusId:t,closeStatusId:r,prOpenedCommentTemplate:n,prReopenedCommentTemplate:u,prReadyForReviewCommentTemplate:c,prClosedCommentTemplate:l,prMergedCommentTemplate:f,apiHost:p,apiKey:m})=>{const{issueKey:d,isFix:y,isClose:b,action:g,pr:v}=e;const _=a({apiHost:p,apiKey:m,issueKey:d});const h=(()=>{switch(g){case"opened":return(0,i.default)(n)(e);case"reopened":return(0,i.default)(u)(e);case"ready_for_review":return(0,i.default)(c)(e);case"closed":if(v.merged){return(0,i.default)(f)(e)}else{return(0,i.default)(l)(e)}default:return undefined}})();if(!h){return s.Result.failure("予期しないイベントでした。")}const j=v.draft;if(j){return s.Result.failure("プルリクエストが下書きでした。")}const w=(()=>{if(v.merged&&y)return{statusId:t};if(v.merged&&b)return{statusId:r};else return undefined})();const T={comment:h,...w};const C={method:"PATCH",body:new o.URLSearchParams(T)};const O=await fetch(_,C);if(!O.ok){throw new Error(O.statusText)}return s.Result.success(O.statusText)};t.postComments=postComments},616:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.push=void 0;const n=r(755);const s=r(956);const o=r(85);const i=r(745);const push=async({event:e,projectKey:t,fixKeywords:r,closeKeywords:a,commitMessageRegTemplate:u,pushCommentTemplate:c,fixStatusId:l,closeStatusId:f,apiHost:p,apiKey:m})=>{(0,n.startGroup)("コミット取得中");const{parsedCommits:d}=(0,s.parseCommits)({commits:e.commits,projectKey:t,fixKeywords:r,closeKeywords:a,commitMessageRegTemplate:u});if(!d){return"課題キーのついたコミットが1件も見つかりませんでした。"}(0,n.endGroup)();(0,n.startGroup)("Push先の確認中");const y=(0,o.parseRef)(e.ref,e.repository.html_url);if(!y){return"Git referenceの解析に失敗しました。"}(0,n.endGroup)();(0,n.startGroup)("コメント送信中");await(0,i.postComments)({parsedCommits:d,parsedRef:y,pushCommentTemplate:c,fixStatusId:l,closeStatusId:f,apiHost:p,apiKey:m}).then((e=>{e.forEach((({commits:e,issueKey:t,isFix:r,isClose:s})=>{(0,n.startGroup)(`${e[0].issueKey}:`);e.forEach((({message:e})=>{(0,n.info)(e)}));if(r){(0,n.info)(`${t}を処理済みにしました。`)}if(s){(0,n.info)(`${t}を完了にしました。`)}(0,n.endGroup)()}))}));(0,n.endGroup)();return"正常に送信しました。"};t.push=push},956:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseCommits=void 0;const s=n(r(417));const parseCommits=({commits:e,projectKey:t,fixKeywords:r,closeKeywords:n,commitMessageRegTemplate:o})=>{const i={};const a=RegExp((0,s.default)(o)({projectKey:t,fixKeywords:r,closeKeywords:n}),"s");e.forEach((e=>{const{parsedCommit:t}=parseCommit({commit:e,fixKeywords:r,closeKeywords:n,commitMessageReg:a});if(!t?.issueKey)return;if(i[t.issueKey]){i[t.issueKey].push(t)}else{i[t.issueKey]=[t]}}));const u=Object.keys(i).length;if(u===0){return{parsedCommits:null}}return{parsedCommits:i}};t.parseCommits=parseCommits;const parseCommit=({commit:e,fixKeywords:t,closeKeywords:r,commitMessageReg:n})=>{const s=e.message.match(n);if(!s){return{parsedCommit:null}}const[,o=null,i="",a=""]=s;return{parsedCommit:{...e,issueKey:o,comment:i,keywords:a,isFix:t.includes(a),isClose:r.includes(a)}}}},85:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseRef=void 0;const s=n(r(417));const o=/refs\/[a-z]*\/(.*)/;const i=(0,s.default)("<%= repositoryHtmlUrl %>/tree/<%= name %>");const parseRef=(e,t)=>{const r=o.exec(e)?.[1];if(!r)return;const n=i({repositoryHtmlUrl:t,name:r});return{name:r,url:n}};t.parseRef=parseRef},745:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.postComments=void 0;const s=n(r(417));const o=(0,s.default)("https://<%=apiHost%>/api/v2/issues/<%=issueKey%>?apiKey=<%=apiKey%>");const postComments=({parsedCommits:e,parsedRef:t,...r})=>{const n=[];for(const[s,o]of Object.entries(e)){n.push(createPatchCommentRequest({commits:o,issueKey:s,ref:t,...r}))}return Promise.all(n)};t.postComments=postComments;const createPatchCommentRequest=async({commits:e,ref:t,issueKey:r,fixStatusId:n,closeStatusId:i,pushCommentTemplate:a,apiHost:u,apiKey:c})=>{const l=o({apiHost:u,apiKey:c,issueKey:r});const f=(0,s.default)(a)({commits:e,ref:t});const p=e.map((e=>e.isFix)).includes(true);const m=e.map((e=>e.isClose)).includes(true);const d=(()=>{if(p)return{statusId:n};if(m)return{statusId:i};else return undefined})();const y={comment:f,...d};const b={method:"PATCH",body:new URLSearchParams(y)};const g=await fetch(l,b);if(!g.ok){throw new Error(g.statusText)}return{commits:e,issueKey:r,isFix:p,isClose:m}}},147:e=>{"use strict";e.exports=require("fs")},37:e=>{"use strict";e.exports=require("os")},310:e=>{"use strict";e.exports=require("url")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={id:r,loaded:false,exports:{}};var o=true;try{e[r].call(s.exports,s,s.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}s.loaded=true;return s.exports}(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(399);module.exports=r})(); +require('./sourcemap-register.js');(()=>{var e={790:e=>{var t=/<%=([\s\S]+?)%>/g;e.exports=t},230:(e,t,r)=>{e=r.nmd(e);var n=r(790),s=r(31);var o=800,i=16;var a=1/0,u=9007199254740991;var c="[object Arguments]",l="[object Array]",f="[object AsyncFunction]",p="[object Boolean]",m="[object Date]",d="[object DOMException]",y="[object Error]",b="[object Function]",g="[object GeneratorFunction]",v="[object Map]",_="[object Number]",h="[object Null]",j="[object Object]",w="[object Proxy]",T="[object RegExp]",C="[object Set]",O="[object String]",K="[object Symbol]",S="[object Undefined]",R="[object WeakMap]";var x="[object ArrayBuffer]",I="[object DataView]",M="[object Float32Array]",P="[object Float64Array]",A="[object Int8Array]",F="[object Int16Array]",k="[object Int32Array]",E="[object Uint8Array]",G="[object Uint8ClampedArray]",q="[object Uint16Array]",L="[object Uint32Array]";var $=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var D=/[\\^$.*+?()[\]{}|]/g;var N=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var V=/^\[object .+?Constructor\]$/;var B=/^(?:0|[1-9]\d*)$/;var z=/($^)/;var J=/['\n\r\u2028\u2029\\]/g;var W={};W[M]=W[P]=W[A]=W[F]=W[k]=W[E]=W[G]=W[q]=W[L]=true;W[c]=W[l]=W[x]=W[p]=W[I]=W[m]=W[y]=W[b]=W[v]=W[_]=W[j]=W[T]=W[C]=W[O]=W[R]=false;var Q={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var X=typeof global=="object"&&global&&global.Object===Object&&global;var Y=typeof self=="object"&&self&&self.Object===Object&&self;var Z=X||Y||Function("return this")();var ee=true&&t&&!t.nodeType&&t;var te=ee&&"object"=="object"&&e&&!e.nodeType&&e;var re=te&&te.exports===ee;var ne=re&&X.process;var se=function(){try{var e=te&&te.require&&te.require("util").types;if(e){return e}return ne&&ne.binding&&ne.binding("util")}catch(e){}}();var oe=se&&se.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayMap(e,t){var r=-1,n=e==null?0:e.length,s=Array(n);while(++r1?r[s-1]:undefined,i=s>2?r[2]:undefined;o=e.length>3&&typeof o=="function"?(s--,o):undefined;if(i&&isIterateeCall(r[0],r[1],i)){o=s<3?undefined:o;s=1}t=Object(t);while(++n-1&&e%1==0&&e0){if(++t>=o){return arguments[0]}}else{t=0}return e.apply(undefined,arguments)}}function toSource(e){if(e!=null){try{return ce.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eq(e,t){return e===t||e!==e&&t!==t}var xe=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&le.call(e,"callee")&&!ve.call(e,"callee")};var Ie=Array.isArray;function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}var Me=je||stubFalse;function isError(e){if(!isObjectLike(e)){return false}var t=baseGetTag(e);return t==y||t==d||typeof e.message=="string"&&typeof e.name=="string"&&!isPlainObject(e)}function isFunction(e){if(!isObject(e)){return false}var t=baseGetTag(e);return t==b||t==g||t==f||t==w}function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=u}function isObject(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function isObjectLike(e){return e!=null&&typeof e=="object"}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=j){return false}var t=ge(e);if(t===null){return true}var r=le.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ce.call(r)==me}function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==K}var Pe=oe?baseUnary(oe):baseIsTypedArray;function toString(e){return e==null?"":baseToString(e)}var Ae=createAssigner((function(e,t,r,n){copyObject(t,keysIn(t),e,n)}));function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,true):baseKeysIn(e)}function template(e,t,r){var o=s.imports._.templateSettings||s;if(r&&isIterateeCall(e,t,r)){t=undefined}e=toString(e);t=Ae({},t,o,customDefaultsAssignIn);var i=Ae({},t.imports,o.imports,customDefaultsAssignIn),a=keys(i),u=baseValues(i,a);var c,l,f=0,p=t.interpolate||z,m="__p += '";var d=RegExp((t.escape||z).source+"|"+p.source+"|"+(p===n?N:z).source+"|"+(t.evaluate||z).source+"|$","g");var y=le.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";e.replace(d,(function(t,r,n,s,o,i){n||(n=s);m+=e.slice(f,i).replace(J,escapeStringChar);if(r){c=true;m+="' +\n__e("+r+") +\n'"}if(o){l=true;m+="';\n"+o+";\n__p += '"}if(n){m+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"}f=i+t.length;return t}));m+="';\n";var b=le.call(t,"variable")&&t.variable;if(!b){m="with (obj) {\n"+m+"\n}\n"}m=(l?m.replace($,""):m).replace(U,"$1").replace(H,"$1;");m="function("+(b||"obj")+") {\n"+(b?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+m+"return __p\n}";var g=Fe((function(){return Function(a,y+"return "+m).apply(undefined,u)}));g.source=m;if(isError(g)){throw g}return g}var Fe=baseRest((function(e,t){try{return apply(e,undefined,t)}catch(e){return isError(e)?e:new Error(e)}}));function constant(e){return function(){return e}}function identity(e){return e}function stubFalse(){return false}e.exports=template},31:(e,t,r)=>{var n=r(790);var s=1/0;var o="[object Null]",i="[object Symbol]",a="[object Undefined]";var u=/[&<>"']/g,c=RegExp(u.source);var l=/<%-([\s\S]+?)%>/g,f=/<%([\s\S]+?)%>/g;var p={"&":"&","<":"<",">":">",'"':""","'":"'"};var m=typeof global=="object"&&global&&global.Object===Object&&global;var d=typeof self=="object"&&self&&self.Object===Object&&self;var y=m||d||Function("return this")();function arrayMap(e,t){var r=-1,n=e==null?0:e.length,s=Array(n);while(++r{"use strict";var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var __export=(e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,o,i,a)=>{if(o&&typeof o==="object"||typeof o==="function"){for(let u of n(o))if(!s.call(e,u)&&u!==i)t(e,u,{get:()=>o[u],enumerable:!(a=r(o,u))||a.enumerable})}return e};var __toCommonJS=e=>__copyProps(t({},"__esModule",{value:true}),e);var o={};__export(o,{Result:()=>a,prototype:()=>i});e.exports=__toCommonJS(o);function getOrThrow(){if(this.isSuccess)return this.value;throw this.error}function toUnion(){if(this.isSuccess)return this.value;return this.error}function ifSuccess(e){if(this.isFailure)return void 0;return e(this.value)}function ifFailure(e){if(this.isSuccess)return void 0;return e(this.error)}function match(e,t){if(this.isSuccess)return e(this.value);return t(this.error)}function map(e){if(this.isFailure)return this;return a.success(e(this.value))}function mapError(e){if(this.isSuccess)return this;return a.failure(e(this.error))}function flatMap(e){if(this.isFailure)return this;return e(this.value)}function flatten(){if(this.isFailure)return this;return this.value}function assertErrorInstanceOf(e){if(this.isSuccess)return this;if(this.error instanceof e)return this;throw new TypeError(`Assertion failed: Expected error to be an instance of ${e.name}.`)}var i={getOrThrow:getOrThrow,toUnion:toUnion,ifSuccess:ifSuccess,ifFailure:ifFailure,match:match,map:map,mapError:mapError,flatMap:flatMap,flatten:flatten,assertErrorInstanceOf:assertErrorInstanceOf};var a;(e=>{function success(e){return withPrototype({value:e,isSuccess:true,isFailure:false},i)}e.success=success;function failure(e){return withPrototype({error:e,isSuccess:false,isFailure:true},i)}e.failure=failure;function tryCatch(e){try{return success(e())}catch(e){return failure(e)}}e.tryCatch=tryCatch;async function fromPromise(e){try{return success(await e)}catch(e){return failure(e)}}e.fromPromise=fromPromise;function fromNullish(e){return e!=null?success(e):failure(e)}e.fromNullish=fromNullish;function all(e){const t=[];for(const r of e){if(r.isFailure)return r;t.push(r.value)}return success(t)}e.all=all})(a||(a={}));function withPrototype(e,t){return Object.assign(Object.create(t),e)}0&&0},685:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var s=Object.getOwnPropertyDescriptor(t,r);if(!s||("get"in s?!t.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,s)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))n(t,e,r);s(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.info=info;t.startGroup=startGroup;t.endGroup=endGroup;t.setFailed=setFailed;const i=o(r(857));const a="::";var u;(function(e){e[e["success"]=0]="success";e[e["failure"]=1]="failure"})(u||(u={}));function info(e){process.stdout.write(e+i.EOL)}function startGroup(e){process.stdout.write(a+"group"+a+e+i.EOL)}function endGroup(){process.stdout.write(a+"endgroup"+a+i.EOL)}function setFailed(e){const t=e instanceof Error?e.toString():e;process.exitCode=u.failure;process.stdout.write(a+"error"+a+t+i.EOL)}},855:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.main=void 0;const n=r(685);const s=r(966);const o=r(861);const i=r(235);const a=r(353);const runAction=async()=>{(0,n.startGroup)("設定を読み込み中");const{projectKey:e,apiHost:t,apiKey:r,githubEventPath:u,fixKeywords:c,closeKeywords:l,pushCommentTemplate:f,prOpenedCommentTemplate:p,prReopenedCommentTemplate:m,prReadyForReviewCommentTemplate:d,prClosedCommentTemplate:y,prMergedCommentTemplate:b,commitMessageRegTemplate:g,prTitleRegTemplate:v,fixStatusId:_,closeStatusId:h}=(0,o.getConfigs)();(0,n.endGroup)();(0,n.startGroup)("イベントを読み込み中");const{event:j}=(0,s.fetchEvent)({path:u});(0,n.endGroup)();if(j&&"commits"in j&&j.commits.length>0){return await(0,a.push)({event:j,projectKey:e,apiHost:t,apiKey:r,fixKeywords:c,closeKeywords:l,pushCommentTemplate:f,commitMessageRegTemplate:g,fixStatusId:_,closeStatusId:h})}if(j&&"pull_request"in j&&"number"in j){return await(0,i.pr)({event:j,projectKey:e,apiHost:t,apiKey:r,fixKeywords:c,closeKeywords:l,fixStatusId:_,closeStatusId:h,prOpenedCommentTemplate:p,prReopenedCommentTemplate:m,prReadyForReviewCommentTemplate:d,prClosedCommentTemplate:y,prMergedCommentTemplate:b,prTitleRegTemplate:v})}return"予期しないイベントでした。"};const main=async()=>{try{const e=await runAction();(0,n.info)(e)}catch(e){if(e instanceof Error){(0,n.setFailed)(e)}else{(0,n.setFailed)(String(e))}}(0,n.endGroup)()};t.main=main;void(0,t.main)()},966:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.fetchEvent=void 0;const n=r(896);const fetchEvent=({path:e})=>{const t=(0,n.readFileSync)(e,"utf8");return{event:JSON.parse(t)}};t.fetchEvent=fetchEvent},861:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getConfigs=t.defaultConfigs=void 0;t.getMultilineInput=getMultilineInput;t.defaultConfigs={fixKeywords:["#fix","#fixes","#fixed"],closeKeywords:["#close","#closes","#closed"],pushCommentTemplate:"<%= commits[0].author.name %>さんが[<%= ref.name %>](<%= ref.url %>)にプッシュしました"+"\n"+"<% commits.forEach(commit=>{ %>"+"\n"+"+ [<%= commit.comment %>](<%= commit.url %>) (<% print(commit.id.slice(0, 7)) %>)"+"<% }); %>",prOpenedCommentTemplate:"<%= sender.login %>さんがプルリクエストを作成しました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prReopenedCommentTemplate:"<%= sender.login %>さんがプルリクエストを作成しました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prReadyForReviewCommentTemplate:"<%= sender.login %>さんがプルリクエストを作成しました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prClosedCommentTemplate:"<%= sender.login %>さんがプルリクエストをクローズしました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",prMergedCommentTemplate:"<%= sender.login %>さんがプルリクエストをマージしました"+"\n\n"+"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)",commitMessageRegTemplate:"^"+"(<%= projectKey %>\\-\\d+)\\s?"+"(.*?)?\\s?"+"(<% print(fixKeywords.join('|')) %>|<% print(closeKeywords.join('|')) %>)?"+"$",prTitleRegTemplate:"^"+"(<%= projectKey %>\\-\\d+)\\s?"+"(.*?)?\\s?"+"(<% print(fixKeywords.join('|')) %>|<% print(closeKeywords.join('|')) %>)?"+"$",fixStatusId:"3",closeStatusId:"4"};const getConfigs=()=>({projectKey:getConfig("project_key",{required:true}),apiHost:getConfig("api_host",{required:true}),apiKey:getConfig("api_key",{required:true}),githubEventPath:getConfig("github_event_path",{required:true}),fixKeywords:getConfig("fix_keywords")?getMultilineInput("fix_keywords"):t.defaultConfigs.fixKeywords,closeKeywords:getConfig("close_keywords")?getMultilineInput("close_keywords"):t.defaultConfigs.closeKeywords,pushCommentTemplate:getConfig("push_comment_template")||t.defaultConfigs.pushCommentTemplate,prOpenedCommentTemplate:getConfig("pr_opened_comment_template")||t.defaultConfigs.prOpenedCommentTemplate,prReopenedCommentTemplate:getConfig("pr_reopened_comment_template")||t.defaultConfigs.prReopenedCommentTemplate,prReadyForReviewCommentTemplate:getConfig("pr_ready_for_review_comment_template")||t.defaultConfigs.prReadyForReviewCommentTemplate,prClosedCommentTemplate:getConfig("pr_closed_comment_template")||t.defaultConfigs.prClosedCommentTemplate,prMergedCommentTemplate:getConfig("pr_merged_comment_template")||t.defaultConfigs.prMergedCommentTemplate,commitMessageRegTemplate:getConfig("commit_message_reg_template")||t.defaultConfigs.commitMessageRegTemplate,prTitleRegTemplate:getConfig("pr_title_reg_template")||t.defaultConfigs.prTitleRegTemplate,fixStatusId:getConfig("fix_status_id")||t.defaultConfigs.fixStatusId,closeStatusId:getConfig("close_status_id")||t.defaultConfigs.closeStatusId});t.getConfigs=getConfigs;const getConfig=(e,t={})=>{const r=e.toUpperCase();const n=process.env[`INPUT_${r}`];const s=process.env[r];const o=n||s||"";if(t.required&&!o){throw new Error(`Input required and not supplied: ${e}`)}return o.trim()};function getMultilineInput(e,t={}){const r=getConfig(e,t).split("\n").filter((e=>e!==""));return r.map((e=>e.trim()))}},235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.pr=void 0;const n=r(685);const s=r(734);const o=r(995);const pr=async({event:e,projectKey:t,fixKeywords:r,closeKeywords:i,fixStatusId:a,closeStatusId:u,apiHost:c,apiKey:l,prOpenedCommentTemplate:f,prReopenedCommentTemplate:p,prReadyForReviewCommentTemplate:m,prClosedCommentTemplate:d,prMergedCommentTemplate:y,prTitleRegTemplate:b})=>{(0,n.startGroup)("プルリクエストを取得中");const{parsedPullRequest:g}=(0,s.parsePullRequest)({event:e,projectKey:t,fixKeywords:r,closeKeywords:i,prTitleRegTemplate:b});if(!g){return"課題キーのついたプルリクエストが見つかりませんでした。"}(0,n.endGroup)();(0,n.startGroup)("コメント送信中");const v=await(0,o.postComments)({parsedPullRequest:g,fixStatusId:a,closeStatusId:u,prOpenedCommentTemplate:f,prReopenedCommentTemplate:p,prReadyForReviewCommentTemplate:m,prClosedCommentTemplate:d,prMergedCommentTemplate:y,apiHost:c,apiKey:l});if(v.isFailure){return v.error}(0,n.startGroup)(`${g.issueKey}:`);(0,n.info)(g.title);if(g.isFix){(0,n.info)(`${g.issueKey}を処理済みにしました。`)}if(g.isClose){(0,n.info)(`${g.issueKey}を完了にしました。`)}(0,n.endGroup)();(0,n.endGroup)();return"正常に送信しました。"};t.pr=pr},734:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parsePullRequest=void 0;const s=n(r(230));const parsePullRequest=({event:e,projectKey:t,fixKeywords:r,closeKeywords:n,prTitleRegTemplate:o})=>{const i=RegExp((0,s.default)(o)({projectKey:t,fixKeywords:r,closeKeywords:n}),"s");const a=e.pull_request.title.match(i);const[,u=null,c="",l=""]=a??[];if(!a||!u){return{parsedPullRequest:null}}return{parsedPullRequest:{pr:e.pull_request,action:e.action,sender:e.sender,issueKey:u,title:c,keywords:l,isFix:r.includes(l),isClose:n.includes(l)}}};t.parsePullRequest=parsePullRequest},995:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.postComments=void 0;const s=r(370);const o=r(16);const i=n(r(230));const a=(0,i.default)("https://<%=apiHost%>/api/v2/issues/<%=issueKey%>?apiKey=<%=apiKey%>");const postComments=async({parsedPullRequest:e,fixStatusId:t,closeStatusId:r,prOpenedCommentTemplate:n,prReopenedCommentTemplate:u,prReadyForReviewCommentTemplate:c,prClosedCommentTemplate:l,prMergedCommentTemplate:f,apiHost:p,apiKey:m})=>{const{issueKey:d,isFix:y,isClose:b,action:g,pr:v}=e;const _=a({apiHost:p,apiKey:m,issueKey:d});const h=(()=>{switch(g){case"opened":return(0,i.default)(n)(e);case"reopened":return(0,i.default)(u)(e);case"ready_for_review":return(0,i.default)(c)(e);case"closed":if(v.merged){return(0,i.default)(f)(e)}else{return(0,i.default)(l)(e)}default:return undefined}})();if(!h){return s.Result.failure("予期しないイベントでした。")}const{draft:j}=v;if(j){return s.Result.failure("プルリクエストが下書きでした。")}const w=(()=>{if(v.merged&&y)return{statusId:t};if(v.merged&&b)return{statusId:r};else return undefined})();const T={comment:h,...w};const C={method:"PATCH",body:new o.URLSearchParams(T)};const O=await fetch(_,C);if(!O.ok){throw new Error(O.statusText)}return s.Result.success(O.statusText)};t.postComments=postComments},353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.push=void 0;const n=r(685);const s=r(362);const o=r(477);const i=r(49);const push=async({event:e,projectKey:t,fixKeywords:r,closeKeywords:a,commitMessageRegTemplate:u,pushCommentTemplate:c,fixStatusId:l,closeStatusId:f,apiHost:p,apiKey:m})=>{(0,n.startGroup)("コミット取得中");const{parsedCommits:d}=(0,s.parseCommits)({commits:e.commits,projectKey:t,fixKeywords:r,closeKeywords:a,commitMessageRegTemplate:u});if(!d){return"課題キーのついたコミットが1件も見つかりませんでした。"}(0,n.endGroup)();(0,n.startGroup)("Push先の確認中");const y=(0,o.parseRef)(e.ref,e.repository.html_url);if(!y){return"Git referenceの解析に失敗しました。"}(0,n.endGroup)();(0,n.startGroup)("コメント送信中");await(0,i.postComments)({parsedCommits:d,parsedRef:y,pushCommentTemplate:c,fixStatusId:l,closeStatusId:f,apiHost:p,apiKey:m}).then((e=>{e.forEach((({commits:e,issueKey:t,isFix:r,isClose:s})=>{(0,n.startGroup)(`${e[0].issueKey}:`);e.forEach((({message:e})=>{(0,n.info)(e)}));if(r){(0,n.info)(`${t}を処理済みにしました。`)}if(s){(0,n.info)(`${t}を完了にしました。`)}(0,n.endGroup)()}))}));(0,n.endGroup)();return"正常に送信しました。"};t.push=push},362:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseCommits=void 0;const s=n(r(230));const parseCommits=({commits:e,projectKey:t,fixKeywords:r,closeKeywords:n,commitMessageRegTemplate:o})=>{const i={};const a=RegExp((0,s.default)(o)({projectKey:t,fixKeywords:r,closeKeywords:n}),"s");e.forEach((e=>{const{parsedCommit:t}=parseCommit({commit:e,fixKeywords:r,closeKeywords:n,commitMessageReg:a});if(!t?.issueKey)return;if(i[t.issueKey]){i[t.issueKey].push(t)}else{i[t.issueKey]=[t]}}));const u=Object.keys(i).length;if(u===0){return{parsedCommits:null}}return{parsedCommits:i}};t.parseCommits=parseCommits;const parseCommit=({commit:e,fixKeywords:t,closeKeywords:r,commitMessageReg:n})=>{const s=e.message.match(n);if(!s){return{parsedCommit:null}}const[,o=null,i="",a=""]=s;return{parsedCommit:{...e,issueKey:o,comment:i,keywords:a,isFix:t.includes(a),isClose:r.includes(a)}}}},477:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseRef=void 0;const s=n(r(230));const o=/refs\/[a-z]*\/(.*)/;const i=(0,s.default)("<%= repositoryHtmlUrl %>/tree/<%= name %>");const parseRef=(e,t)=>{const r=o.exec(e)?.[1];if(!r)return;const n=i({repositoryHtmlUrl:t,name:r});return{name:r,url:n}};t.parseRef=parseRef},49:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.postComments=void 0;const s=n(r(230));const o=(0,s.default)("https://<%=apiHost%>/api/v2/issues/<%=issueKey%>?apiKey=<%=apiKey%>");const postComments=async({parsedCommits:e,parsedRef:t,...r})=>{const n=[];for(const[s,o]of Object.entries(e)){n.push(createPatchCommentRequest({commits:o,issueKey:s,ref:t,...r}))}return await Promise.all(n)};t.postComments=postComments;const createPatchCommentRequest=async({commits:e,ref:t,issueKey:r,fixStatusId:n,closeStatusId:i,pushCommentTemplate:a,apiHost:u,apiKey:c})=>{const l=o({apiHost:u,apiKey:c,issueKey:r});const f=(0,s.default)(a)({commits:e,ref:t});const p=e.map((e=>e.isFix)).includes(true);const m=e.map((e=>e.isClose)).includes(true);const d=(()=>{if(p)return{statusId:n};if(m)return{statusId:i};else return undefined})();const y={comment:f,...d};const b={method:"PATCH",body:new URLSearchParams(y)};const g=await fetch(l,b);if(!g.ok){throw new Error(g.statusText)}return{commits:e,issueKey:r,isFix:p,isClose:m}}},896:e=>{"use strict";e.exports=require("fs")},857:e=>{"use strict";e.exports=require("os")},16:e=>{"use strict";e.exports=require("url")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={id:r,loaded:false,exports:{}};var o=true;try{e[r].call(s.exports,s,s.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}s.loaded=true;return s.exports}(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(855);module.exports=r})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 369b34b..0217424 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["__createBinding","this","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__setModuleDefault","v","value","__importStar","mod","result","prototype","hasOwnProperty","call","exports","setFailed","endGroup","startGroup","info","os","__webpack_require__","cmd","ExitCode","message","process","stdout","write","EOL","name","error","Error","toString","exitCode","failure","main","stdout_1","fetchEvent_1","getConfigs_1","pr_1","push_1","runAction","async","projectKey","apiHost","apiKey","githubEventPath","fixKeywords","closeKeywords","pushCommentTemplate","prOpenedCommentTemplate","prReopenedCommentTemplate","prReadyForReviewCommentTemplate","prClosedCommentTemplate","prMergedCommentTemplate","commitMessageRegTemplate","prTitleRegTemplate","fixStatusId","closeStatusId","getConfigs","event","fetchEvent","path","commits","length","push","pr","String","fs_1","readFileSync","JSON","parse","getMultilineInput","defaultConfigs","getConfig","required","options","key","toUpperCase","input","env","val","trim","inputs","split","filter","x","map","parsePullRequest_1","postComments_1","parsedPullRequest","parsePullRequest","postComments","isFailure","issueKey","title","isFix","isClose","__importDefault","default","lodash_template_1","prTitleReg","RegExp","match","pull_request","keywords","action","sender","includes","result_type_ts_1","url_1","updateIssueApiUrlTemplate","endpoint","comment","merged","Result","draft","status","statusId","body","fetchOptions","method","URLSearchParams","response","fetch","ok","statusText","success","parseCommits_1","parseRef_1","parsedCommits","parseCommits","parsedRef","parseRef","ref","repository","html_url","then","data","forEach","commitMessageReg","commit","parsedCommit","parseCommit","commitCount","keys","refReg","refUrlTemplate","repositoryHtmlUrl","exec","url","configs","promiseArray","entries","createPatchCommentRequest","Promise","all","__webpack_module_cache__","moduleId","cachedModule","module","id","loaded","threw","__webpack_modules__","__webpack_exports__"],"sources":[".././src/common/stdout.ts",".././src/main.ts",".././src/main/fetchEvent.ts",".././src/main/getConfigs.ts",".././src/pr/index.ts",".././src/pr/parsePullRequest.ts",".././src/pr/postComments.ts",".././src/push/index.ts",".././src/push/parseCommits.ts",".././src/push/parseRef.ts",".././src/push/postComments.ts","../webpack/bootstrap","../webpack/startup"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.setFailed = exports.endGroup = exports.startGroup = exports.info = void 0;\nconst os = __importStar(require(\"os\"));\nconst cmd = \"::\";\nvar ExitCode;\n(function (ExitCode) {\n ExitCode[ExitCode[\"success\"] = 0] = \"success\";\n ExitCode[ExitCode[\"failure\"] = 1] = \"failure\";\n})(ExitCode || (ExitCode = {}));\n/**\n * Writes info to log with newline.\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n */\nfunction startGroup(name) {\n process.stdout.write(cmd + \"group\" + cmd + name + os.EOL);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n process.stdout.write(cmd + \"endgroup\" + cmd + os.EOL);\n}\nexports.endGroup = endGroup;\n/**\n * Sets the action status to failed.\n */\nfunction setFailed(message) {\n const error = message instanceof Error ? message.toString() : message;\n process.exitCode = ExitCode.failure;\n process.stdout.write(cmd + \"error\" + cmd + error + os.EOL);\n}\nexports.setFailed = setFailed;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.main = void 0;\nconst stdout_1 = require(\"./common/stdout\");\nconst fetchEvent_1 = require(\"./main/fetchEvent\");\nconst getConfigs_1 = require(\"./main/getConfigs\");\nconst pr_1 = require(\"./pr\");\nconst push_1 = require(\"./push\");\nconst runAction = async () => {\n (0, stdout_1.startGroup)(\"設定を読み込み中\");\n const { projectKey, apiHost, apiKey, githubEventPath, fixKeywords, closeKeywords, pushCommentTemplate, prOpenedCommentTemplate, prReopenedCommentTemplate, prReadyForReviewCommentTemplate, prClosedCommentTemplate, prMergedCommentTemplate, commitMessageRegTemplate, prTitleRegTemplate, fixStatusId, closeStatusId, } = (0, getConfigs_1.getConfigs)();\n (0, stdout_1.endGroup)();\n (0, stdout_1.startGroup)(\"イベントを読み込み中\");\n const { event } = (0, fetchEvent_1.fetchEvent)({ path: githubEventPath });\n (0, stdout_1.endGroup)();\n if (event && \"commits\" in event && event.commits.length > 0) {\n return await (0, push_1.push)({\n event,\n projectKey,\n apiHost,\n apiKey,\n fixKeywords,\n closeKeywords,\n pushCommentTemplate,\n commitMessageRegTemplate,\n fixStatusId,\n closeStatusId,\n });\n }\n if (event && \"pull_request\" in event && \"number\" in event) {\n return await (0, pr_1.pr)({\n event,\n projectKey,\n apiHost,\n apiKey,\n fixKeywords,\n closeKeywords,\n fixStatusId,\n closeStatusId,\n prOpenedCommentTemplate,\n prReopenedCommentTemplate,\n prReadyForReviewCommentTemplate,\n prClosedCommentTemplate,\n prMergedCommentTemplate,\n prTitleRegTemplate,\n });\n }\n return \"予期しないイベントでした。\";\n};\nconst main = async () => {\n try {\n const message = await runAction();\n (0, stdout_1.info)(message);\n }\n catch (error) {\n if (error instanceof Error) {\n (0, stdout_1.setFailed)(error);\n }\n else {\n (0, stdout_1.setFailed)(String(error));\n }\n }\n (0, stdout_1.endGroup)();\n};\nexports.main = main;\n(0, exports.main)();\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.fetchEvent = void 0;\nconst fs_1 = require(\"fs\");\n/**\n * Fetch and Parses event from event.json file\n * @param path Path to event.json\n * @returns Parsed event from event.json\n */\nconst fetchEvent = ({ path }) => {\n const event = (0, fs_1.readFileSync)(path, \"utf8\");\n return { event: JSON.parse(event) };\n};\nexports.fetchEvent = fetchEvent;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getMultilineInput = exports.getConfigs = exports.defaultConfigs = void 0;\nexports.defaultConfigs = {\n fixKeywords: [\"#fix\", \"#fixes\", \"#fixed\"],\n closeKeywords: [\"#close\", \"#closes\", \"#closed\"],\n pushCommentTemplate: \"<%= commits[0].author.name %>さんが[<%= ref.name %>](<%= ref.url %>)にプッシュしました\" +\n \"\\n\" +\n \"<% commits.forEach(commit=>{ %>\" +\n \"\\n\" +\n \"+ [<%= commit.comment %>](<%= commit.url %>) (<% print(commit.id.slice(0, 7)) %>)\" +\n \"<% }); %>\",\n prOpenedCommentTemplate: \"<%= sender.login %>さんがプルリクエストを作成しました\" +\n \"\\n\\n\" +\n \"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)\",\n prReopenedCommentTemplate: \"<%= sender.login %>さんがプルリクエストを作成しました\" +\n \"\\n\\n\" +\n \"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)\",\n prReadyForReviewCommentTemplate: \"<%= sender.login %>さんがプルリクエストを作成しました\" +\n \"\\n\\n\" +\n \"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)\",\n prClosedCommentTemplate: \"<%= sender.login %>さんがプルリクエストをクローズしました\" +\n \"\\n\\n\" +\n \"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)\",\n prMergedCommentTemplate: \"<%= sender.login %>さんがプルリクエストをマージしました\" +\n \"\\n\\n\" +\n \"+ [<%= title %>](<%= pr.html_url %>) (#<%= pr.number %>)\",\n commitMessageRegTemplate: \"^\" +\n \"(<%= projectKey %>\\\\-\\\\d+)\\\\s?\" +\n \"(.*?)?\\\\s?\" +\n \"(<% print(fixKeywords.join('|')) %>|<% print(closeKeywords.join('|')) %>)?\" +\n \"$\",\n prTitleRegTemplate: \"^\" +\n \"(<%= projectKey %>\\\\-\\\\d+)\\\\s?\" +\n \"(.*?)?\\\\s?\" +\n \"(<% print(fixKeywords.join('|')) %>|<% print(closeKeywords.join('|')) %>)?\" +\n \"$\",\n fixStatusId: \"3\",\n closeStatusId: \"4\",\n};\n/**\n * Parses and validations the action configuration\n * @returns Parsed the action configuration\n * @throws {Error} Will throw an error if missing required input\n */\nconst getConfigs = () => {\n return {\n projectKey: getConfig(\"project_key\", { required: true }),\n apiHost: getConfig(\"api_host\", { required: true }),\n apiKey: getConfig(\"api_key\", { required: true }),\n githubEventPath: getConfig(\"github_event_path\", { required: true }),\n fixKeywords: getConfig(\"fix_keywords\")\n ? getMultilineInput(\"fix_keywords\")\n : exports.defaultConfigs.fixKeywords,\n closeKeywords: getConfig(\"close_keywords\")\n ? getMultilineInput(\"close_keywords\")\n : exports.defaultConfigs.closeKeywords,\n pushCommentTemplate: getConfig(\"push_comment_template\") || exports.defaultConfigs.pushCommentTemplate,\n prOpenedCommentTemplate: getConfig(\"pr_opened_comment_template\") ||\n exports.defaultConfigs.prOpenedCommentTemplate,\n prReopenedCommentTemplate: getConfig(\"pr_reopened_comment_template\") ||\n exports.defaultConfigs.prReopenedCommentTemplate,\n prReadyForReviewCommentTemplate: getConfig(\"pr_ready_for_review_comment_template\") ||\n exports.defaultConfigs.prReadyForReviewCommentTemplate,\n prClosedCommentTemplate: getConfig(\"pr_closed_comment_template\") ||\n exports.defaultConfigs.prClosedCommentTemplate,\n prMergedCommentTemplate: getConfig(\"pr_merged_comment_template\") ||\n exports.defaultConfigs.prMergedCommentTemplate,\n commitMessageRegTemplate: getConfig(\"commit_message_reg_template\") ||\n exports.defaultConfigs.commitMessageRegTemplate,\n prTitleRegTemplate: getConfig(\"pr_title_reg_template\") || exports.defaultConfigs.prTitleRegTemplate,\n fixStatusId: getConfig(\"fix_status_id\") || exports.defaultConfigs.fixStatusId,\n closeStatusId: getConfig(\"close_status_id\") || exports.defaultConfigs.closeStatusId,\n };\n};\nexports.getConfigs = getConfigs;\n/**\n * First gets the value of the action configuration. If not defined,\n * gets the value of the environment variable. If not defined,\n * returns an empty string.\n *\n * @param name Name of the input or env to get\n * @param options See InputOptions type\n * @returns Trimmed value\n */\nconst getConfig = (name, options = {}) => {\n const key = name.toUpperCase();\n const input = process.env[`INPUT_${key}`];\n const env = process.env[key];\n const val = input || env || \"\";\n if (options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n return val.trim();\n};\n/**\n * Gets the values of an multiline input.\n * Each value is also trimmed.\n *\n * @param name Name of the input to get\n * @returns string[]\n *\n */\nfunction getMultilineInput(name, options = {}) {\n const inputs = getConfig(name, options)\n .split(\"\\n\")\n .filter((x) => x !== \"\");\n return inputs.map((input) => input.trim());\n}\nexports.getMultilineInput = getMultilineInput;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pr = void 0;\nconst stdout_1 = require(\"../common/stdout\");\nconst parsePullRequest_1 = require(\"./parsePullRequest\");\nconst postComments_1 = require(\"./postComments\");\nconst pr = async ({ event, projectKey, fixKeywords, closeKeywords, fixStatusId, closeStatusId, apiHost, apiKey, prOpenedCommentTemplate, prReopenedCommentTemplate, prReadyForReviewCommentTemplate, prClosedCommentTemplate, prMergedCommentTemplate, prTitleRegTemplate, }) => {\n (0, stdout_1.startGroup)(\"プルリクエストを取得中\");\n const { parsedPullRequest } = (0, parsePullRequest_1.parsePullRequest)({\n event,\n projectKey,\n fixKeywords,\n closeKeywords,\n prTitleRegTemplate,\n });\n if (!parsedPullRequest) {\n return \"課題キーのついたプルリクエストが見つかりませんでした。\";\n }\n (0, stdout_1.endGroup)();\n (0, stdout_1.startGroup)(\"コメント送信中\");\n const result = await (0, postComments_1.postComments)({\n parsedPullRequest,\n fixStatusId,\n closeStatusId,\n prOpenedCommentTemplate,\n prReopenedCommentTemplate,\n prReadyForReviewCommentTemplate,\n prClosedCommentTemplate,\n prMergedCommentTemplate,\n apiHost,\n apiKey,\n });\n if (result.isFailure) {\n return result.error;\n }\n (0, stdout_1.startGroup)(`${parsedPullRequest.issueKey}:`);\n (0, stdout_1.info)(parsedPullRequest.title);\n if (parsedPullRequest.isFix) {\n (0, stdout_1.info)(`${parsedPullRequest.issueKey}を処理済みにしました。`);\n }\n if (parsedPullRequest.isClose) {\n (0, stdout_1.info)(`${parsedPullRequest.issueKey}を完了にしました。`);\n }\n (0, stdout_1.endGroup)();\n (0, stdout_1.endGroup)();\n return \"正常に送信しました。\";\n};\nexports.pr = pr;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parsePullRequest = void 0;\nconst lodash_template_1 = __importDefault(require(\"lodash.template\"));\n/**\n * Parse the pull request from the event\n */\nconst parsePullRequest = ({ event, projectKey, fixKeywords, closeKeywords, prTitleRegTemplate, }) => {\n const prTitleReg = RegExp((0, lodash_template_1.default)(prTitleRegTemplate)({\n projectKey,\n fixKeywords,\n closeKeywords,\n }), \"s\");\n const match = event.pull_request.title.match(prTitleReg);\n const [, issueKey = null, title = \"\", keywords = \"\"] = match ?? [];\n if (!match || !issueKey) {\n return { parsedPullRequest: null };\n }\n return {\n parsedPullRequest: {\n pr: event.pull_request,\n action: event.action,\n sender: event.sender,\n issueKey,\n title,\n keywords,\n isFix: fixKeywords.includes(keywords),\n isClose: closeKeywords.includes(keywords),\n },\n };\n};\nexports.parsePullRequest = parsePullRequest;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.postComments = void 0;\nconst result_type_ts_1 = require(\"result-type-ts\");\nconst url_1 = require(\"url\");\nconst lodash_template_1 = __importDefault(require(\"lodash.template\"));\n// Update Issue API\n// https://developer.nulab.com/docs/backlog/api/2/update-issue/\nconst updateIssueApiUrlTemplate = (0, lodash_template_1.default)(\"https://<%=apiHost%>/api/v2/issues/<%=issueKey%>?apiKey=<%=apiKey%>\");\n/**\n * Post the comment to Backlog API\n */\nconst postComments = async ({ parsedPullRequest, fixStatusId, closeStatusId, prOpenedCommentTemplate, prReopenedCommentTemplate, prReadyForReviewCommentTemplate, prClosedCommentTemplate, prMergedCommentTemplate, apiHost, apiKey, }) => {\n const { issueKey, isFix, isClose, action, pr } = parsedPullRequest;\n const endpoint = updateIssueApiUrlTemplate({\n apiHost,\n apiKey,\n issueKey,\n });\n const comment = (() => {\n switch (action) {\n case \"opened\":\n return (0, lodash_template_1.default)(prOpenedCommentTemplate)(parsedPullRequest);\n case \"reopened\":\n return (0, lodash_template_1.default)(prReopenedCommentTemplate)(parsedPullRequest);\n case \"ready_for_review\":\n return (0, lodash_template_1.default)(prReadyForReviewCommentTemplate)(parsedPullRequest);\n case \"closed\":\n if (pr.merged) {\n return (0, lodash_template_1.default)(prMergedCommentTemplate)(parsedPullRequest);\n }\n else {\n return (0, lodash_template_1.default)(prClosedCommentTemplate)(parsedPullRequest);\n }\n default:\n return undefined;\n }\n })();\n if (!comment) {\n return result_type_ts_1.Result.failure(\"予期しないイベントでした。\");\n }\n const draft = pr.draft;\n if (draft) {\n return result_type_ts_1.Result.failure(\"プルリクエストが下書きでした。\");\n }\n const status = (() => {\n if (pr.merged && isFix)\n return { statusId: fixStatusId };\n if (pr.merged && isClose)\n return { statusId: closeStatusId };\n else\n return undefined;\n })();\n const body = { comment, ...status };\n const fetchOptions = {\n method: \"PATCH\",\n body: new url_1.URLSearchParams(body),\n };\n const response = await fetch(endpoint, fetchOptions);\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n return result_type_ts_1.Result.success(response.statusText);\n};\nexports.postComments = postComments;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.push = void 0;\nconst stdout_1 = require(\"../common/stdout\");\nconst parseCommits_1 = require(\"./parseCommits\");\nconst parseRef_1 = require(\"./parseRef\");\nconst postComments_1 = require(\"./postComments\");\nconst push = async ({ event, projectKey, fixKeywords, closeKeywords, commitMessageRegTemplate, pushCommentTemplate, fixStatusId, closeStatusId, apiHost, apiKey, }) => {\n (0, stdout_1.startGroup)(\"コミット取得中\");\n const { parsedCommits } = (0, parseCommits_1.parseCommits)({\n commits: event.commits,\n projectKey,\n fixKeywords,\n closeKeywords,\n commitMessageRegTemplate,\n });\n if (!parsedCommits) {\n return \"課題キーのついたコミットが1件も見つかりませんでした。\";\n }\n (0, stdout_1.endGroup)();\n (0, stdout_1.startGroup)(\"Push先の確認中\");\n const parsedRef = (0, parseRef_1.parseRef)(event.ref, event.repository.html_url);\n if (!parsedRef) {\n return \"Git referenceの解析に失敗しました。\";\n }\n (0, stdout_1.endGroup)();\n (0, stdout_1.startGroup)(\"コメント送信中\");\n await (0, postComments_1.postComments)({\n parsedCommits,\n parsedRef,\n pushCommentTemplate,\n fixStatusId,\n closeStatusId,\n apiHost,\n apiKey,\n }).then((data) => {\n data.forEach(({ commits, issueKey, isFix, isClose }) => {\n (0, stdout_1.startGroup)(`${commits[0].issueKey}:`);\n commits.forEach(({ message }) => {\n (0, stdout_1.info)(message);\n });\n if (isFix) {\n (0, stdout_1.info)(`${issueKey}を処理済みにしました。`);\n }\n if (isClose) {\n (0, stdout_1.info)(`${issueKey}を完了にしました。`);\n }\n (0, stdout_1.endGroup)();\n });\n });\n (0, stdout_1.endGroup)();\n return \"正常に送信しました。\";\n};\nexports.push = push;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseCommits = void 0;\nconst lodash_template_1 = __importDefault(require(\"lodash.template\"));\n/**\n * Parse commits from the event commits\n * @param commits commits from the event commits\n * @param projectKey Backlog project key\n * @param fixKeywords Keywords to change the status of the issue to fixed\n * @param closeKeywords Keywords to change the status of the issue to closed\n * @param commitMessageRegTemplate The template for regular expressions to parse commit messages\n * @returns ParsedCommits | null\n */\nconst parseCommits = ({ commits, projectKey, fixKeywords, closeKeywords, commitMessageRegTemplate, }) => {\n const parsedCommits = {};\n const commitMessageReg = RegExp((0, lodash_template_1.default)(commitMessageRegTemplate)({\n projectKey,\n fixKeywords,\n closeKeywords,\n }), \"s\");\n commits.forEach((commit) => {\n const { parsedCommit } = parseCommit({\n commit,\n fixKeywords,\n closeKeywords,\n commitMessageReg,\n });\n if (!parsedCommit?.issueKey)\n return;\n if (parsedCommits[parsedCommit.issueKey]) {\n parsedCommits[parsedCommit.issueKey].push(parsedCommit);\n }\n else {\n parsedCommits[parsedCommit.issueKey] = [parsedCommit];\n }\n });\n const commitCount = Object.keys(parsedCommits).length;\n if (commitCount === 0) {\n return { parsedCommits: null };\n }\n return { parsedCommits };\n};\nexports.parseCommits = parseCommits;\nconst parseCommit = ({ commit, fixKeywords, closeKeywords, commitMessageReg, }) => {\n const match = commit.message.match(commitMessageReg);\n if (!match) {\n return { parsedCommit: null };\n }\n const [, issueKey = null, comment = \"\", keywords = \"\"] = match;\n return {\n parsedCommit: {\n ...commit,\n issueKey,\n comment,\n keywords,\n isFix: fixKeywords.includes(keywords),\n isClose: closeKeywords.includes(keywords),\n },\n };\n};\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRef = void 0;\nconst lodash_template_1 = __importDefault(require(\"lodash.template\"));\nconst refReg = /refs\\/[a-z]*\\/(.*)/;\nconst refUrlTemplate = (0, lodash_template_1.default)(\"<%= repositoryHtmlUrl %>/tree/<%= name %>\");\n/**\n * Parse tree name and url from the event ref and repository html url\n * @param ref The full git ref that was pushed. Example: `refs/heads/main` or `refs/tags/v3.14.1`.\n * @param repositoryHtmlUrl HTML URL of the repository.\n * @returns\n */\nconst parseRef = (ref, repositoryHtmlUrl) => {\n // e.g. Get name `feature/foo ` for ref `refs/heads/feature/foo`\n const name = refReg.exec(ref)?.[1];\n if (!name)\n return;\n const url = refUrlTemplate({ repositoryHtmlUrl, name });\n return { name, url };\n};\nexports.parseRef = parseRef;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.postComments = void 0;\nconst lodash_template_1 = __importDefault(require(\"lodash.template\"));\n// Update Issue API\n// https://developer.nulab.com/docs/backlog/api/2/update-issue/#\nconst updateIssueApiUrlTemplate = (0, lodash_template_1.default)(\"https://<%=apiHost%>/api/v2/issues/<%=issueKey%>?apiKey=<%=apiKey%>\");\n/**\n * Post the comment to Backlog API\n * @param parsedCommits parsed Commits (create by parseCommits.ts)\n * @param parsedRef parsed ref (create by parseRef.ts)\n * @param fixStatusId Status ID to mark as fixed\n * @param closeStatusIdStatus ID to mark as closed\n * @param pushCommentTemplate The template for backlog issue comment on push events\n * @param apiHost Backlog API Host\n * @param apiKey Backlog API Key\n * @returns Patch comment request promises\n */\nconst postComments = ({ parsedCommits, parsedRef, ...configs }) => {\n const promiseArray = [];\n for (const [issueKey, commits] of Object.entries(parsedCommits)) {\n promiseArray.push(createPatchCommentRequest({\n commits,\n issueKey,\n ref: parsedRef,\n ...configs,\n }));\n }\n return Promise.all(promiseArray);\n};\nexports.postComments = postComments;\nconst createPatchCommentRequest = async ({ commits, ref, issueKey, fixStatusId, closeStatusId, pushCommentTemplate, apiHost, apiKey, }) => {\n const endpoint = updateIssueApiUrlTemplate({\n apiHost,\n apiKey,\n issueKey,\n });\n const comment = (0, lodash_template_1.default)(pushCommentTemplate)({ commits, ref });\n const isFix = commits.map((commit) => commit.isFix).includes(true);\n const isClose = commits.map((commit) => commit.isClose).includes(true);\n const status = (() => {\n if (isFix)\n return { statusId: fixStatusId };\n if (isClose)\n return { statusId: closeStatusId };\n else\n return undefined;\n })();\n const body = { comment, ...status };\n const fetchOptions = {\n method: \"PATCH\",\n body: new URLSearchParams(body),\n };\n const response = await fetch(endpoint, fetchOptions);\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n return { commits, issueKey, isFix, isClose };\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__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A,CACAC,OAAA,QACAF,KAAA,IAAAG,gBAAAH,IAEA,MAAAI,QAAAC,MAAAZ,EAAAQ,GACA,IAAAG,EAAAE,GAAA,CACA,UAAA9F,MAAA4F,EAAAG,WACA,CACA,OAAA/D,UAAA+B,WAAAE,QAAAC,UAAA,C,6IC3DA,IAAA4D,EAAA,GAGA,SAAAxI,oBAAAyI,GAEA,IAAAC,EAAAF,EAAAC,GACA,GAAAC,IAAAlK,UAAA,CACA,OAAAkK,EAAAhJ,OACA,CAEA,IAAAiJ,EAAAH,EAAAC,GAAA,CACAG,GAAAH,EACAI,OAAA,MACAnJ,QAAA,IAIA,IAAAoJ,EAAA,KACA,IACAC,EAAAN,GAAAhJ,KAAAkJ,EAAAjJ,QAAAiJ,IAAAjJ,QAAAM,qBACA8I,EAAA,KACA,SACA,GAAAA,SAAAN,EAAAC,EACA,CAGAE,EAAAE,OAAA,KAGA,OAAAF,EAAAjJ,OACA,C,yKC5BA,IAAAsJ,EAAAhJ,oBAAA,K"} \ No newline at end of file +{"version":3,"file":"index.js","names":["reInterpolate","module","exports","__webpack_require__","templateSettings","HOT_COUNT","HOT_SPAN","INFINITY","MAX_SAFE_INTEGER","argsTag","arrayTag","asyncTag","boolTag","dateTag","domExcTag","errorTag","funcTag","genTag","mapTag","numberTag","nullTag","objectTag","proxyTag","regexpTag","setTag","stringTag","symbolTag","undefinedTag","weakMapTag","arrayBufferTag","dataViewTag","float32Tag","float64Tag","int8Tag","int16Tag","int32Tag","uint8Tag","uint8ClampedTag","uint16Tag","uint32Tag","reEmptyStringLeading","reEmptyStringMiddle","reEmptyStringTrailing","reRegExpChar","reEsTemplate","reIsHostCtor","reIsUint","reNoMatch","reUnescapedString","typedArrayTags","stringEscapes","freeGlobal","global","Object","freeSelf","self","root","Function","freeExports","nodeType","freeModule","moduleExports","freeProcess","process","nodeUtil","types","require","binding","e","nodeIsTypedArray","isTypedArray","apply","func","thisArg","args","length","call","arrayMap","array","iteratee","index","result","Array","baseTimes","n","baseUnary","value","baseValues","object","props","key","escapeStringChar","chr","getValue","undefined","overArg","transform","arg","funcProto","prototype","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","uid","exec","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","Symbol","getPrototype","getPrototypeOf","propertyIsEnumerable","symToStringTag","toStringTag","defineProperty","getNative","nativeIsBuffer","isBuffer","nativeKeys","nativeMax","Math","max","nativeNow","Date","now","symbolProto","symbolToString","arrayLikeKeys","inherited","isArr","isArray","isArg","isArguments","isBuff","isType","skipIndexes","String","isIndex","push","assignValue","objValue","eq","baseAssignValue","configurable","enumerable","writable","baseGetTag","getRawTag","objectToString","baseIsArguments","isObjectLike","baseIsNative","isObject","isMasked","pattern","isFunction","test","toSource","baseIsTypedArray","isLength","baseKeys","isPrototype","baseKeysIn","nativeKeysIn","isProto","baseRest","start","setToString","overRest","identity","baseSetToString","string","constant","baseToString","isSymbol","copyObject","source","customizer","isNew","newValue","createAssigner","assigner","sources","guard","isIterateeCall","customDefaultsAssignIn","srcValue","isOwn","tag","unmasked","type","isArrayLike","Ctor","constructor","proto","arguments","otherArgs","this","shortOut","count","lastCalled","stamp","remaining","other","stubFalse","isError","message","name","isPlainObject","assignInWith","srcIndex","keysIn","template","options","settings","imports","_","importsKeys","importsValues","isEscaping","isEvaluating","interpolate","reDelimiters","escape","evaluate","sourceURL","match","escapeValue","interpolateValue","esTemplateValue","evaluateValue","offset","slice","variable","attempt","Error","reUnescapedHtml","reHasUnescapedHtml","reEscape","reEvaluate","htmlEscapes","basePropertyOf","escapeHtmlChar","__defProp","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","__export","target","all","get","__copyProps","to","from","except","desc","__toCommonJS","mod","src_exports","Result","getOrThrow","isSuccess","error","toUnion","ifSuccess","f","isFailure","ifFailure","g","map","success","mapError","failure","flatMap","flatten","assertErrorInstanceOf","TypeError","Result2","withPrototype","tryCatch","async","fromPromise","promise","fromNullish","results","values","prototype2","assign","create","__createBinding","o","m","k","k2","__esModule","__setModuleDefault","v","__importStar","info","startGroup","endGroup","setFailed","os","cmd","ExitCode","stdout","write","EOL","exitCode","main","stdout_1","fetchEvent_1","getConfigs_1","pr_1","push_1","runAction","projectKey","apiHost","apiKey","githubEventPath","fixKeywords","closeKeywords","pushCommentTemplate","prOpenedCommentTemplate","prReopenedCommentTemplate","prReadyForReviewCommentTemplate","prClosedCommentTemplate","prMergedCommentTemplate","commitMessageRegTemplate","prTitleRegTemplate","fixStatusId","closeStatusId","getConfigs","event","fetchEvent","path","commits","pr","fs_1","readFileSync","JSON","parse","defaultConfigs","getMultilineInput","getConfig","required","toUpperCase","input","env","val","trim","inputs","split","filter","x","parsePullRequest_1","postComments_1","parsedPullRequest","parsePullRequest","postComments","issueKey","title","isFix","isClose","__importDefault","default","lodash_template_1","prTitleReg","pull_request","keywords","action","sender","includes","result_type_ts_1","url_1","updateIssueApiUrlTemplate","endpoint","comment","merged","draft","status","statusId","body","fetchOptions","method","URLSearchParams","response","fetch","ok","statusText","parseCommits_1","parseRef_1","parsedCommits","parseCommits","parsedRef","parseRef","ref","repository","html_url","then","data","forEach","commitMessageReg","commit","parsedCommit","parseCommit","commitCount","refReg","refUrlTemplate","repositoryHtmlUrl","url","configs","promiseArray","entries","createPatchCommentRequest","Promise","__webpack_module_cache__","moduleId","cachedModule","id","loaded","threw","__webpack_modules__","nmd","paths","children","ab","__dirname","__webpack_exports__"],"sources":["../node_modules/.pnpm/lodash._reinterpolate@3.0.0/node_modules/lodash._reinterpolate/index.js","../node_modules/.pnpm/lodash.template@4.5.0/node_modules/lodash.template/index.js","../node_modules/.pnpm/lodash.templatesettings@4.2.0/node_modules/lodash.templatesettings/index.js","../node_modules/.pnpm/result-type-ts@2.1.3/node_modules/result-type-ts/dist/index.js","../src/common/stdout.ts","../src/main.ts","../src/main/fetchEvent.ts","../src/main/getConfigs.ts","../src/pr/index.ts","../src/pr/parsePullRequest.ts","../src/pr/postComments.ts","../src/push/index.ts","../src/push/parseCommits.ts","../src/push/parseRef.ts","../src/push/postComments.ts","../external node-commonjs \"fs\"","../external node-commonjs \"os\"","../external node-commonjs \"url\"","../webpack/bootstrap","../webpack/runtime/node module decorator","../webpack/runtime/compat","../webpack/startup"],"sourcesContent":["/**\n * lodash 3.0.0 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.7.0 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used to match template delimiters. */\nvar reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\nmodule.exports = reInterpolate;\n","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\nvar reInterpolate = require('lodash._reinterpolate'),\n templateSettings = require('lodash.templatesettings');\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n domExcTag = '[object DOMException]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to match empty string literals in compiled template source. */\nvar reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\nvar reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to ensure capturing order of template delimiters. */\nvar reNoMatch = /($^)/;\n\n/** Used to match unescaped characters in compiled string literals. */\nvar reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Used to escape characters for inclusion in compiled string literals. */\nvar stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\n/**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nfunction escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\nfunction isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<%- value %>');\n * compiled({ 'value': '