diff --git a/.node-version b/.node-version index 2a393af..7af24b7 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.18.0 +22.11.0 diff --git a/.prettierignore b/.prettierignore index 148b489..a1300a0 100644 --- a/.prettierignore +++ b/.prettierignore @@ -63,3 +63,6 @@ typings/ # next.js build output .next + +# pnpm +pnpm-lock.yaml diff --git a/action.yml b/action.yml index c6f9734..430767c 100644 --- a/action.yml +++ b/action.yml @@ -5,7 +5,7 @@ branding: icon: bell color: green runs: - using: node20 + using: node22 main: dist/index.js inputs: project_key: diff --git a/dist/index.js b/dist/index.js index b429498..2da0829 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1 @@ -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 +(()=>{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(865);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})(); \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 0217424..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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': '