(function(){function g(d,e,b,f,c,m){e[d]&&(b.push(d),(!0===e[d]||1===e[d])&&f.push(c+d+"/"+m))}function l(d,e,b,f,c){e=f+e+"/"+c;require._fileExists(d.toUrl(e+".js"))&&b.push(e)}function k(d,e,b){for(var f in e)e.hasOwnProperty(f)&&(!d.hasOwnProperty(f)||b)?d[f]=e[f]:"object"===typeof e[f]&&k(d[f],e[f],b)}var e=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(d){var h=d.config?d.config():{},h=h||{};return{version:"2.0.1+",load:function(b,f,c,m){m=m||{};m.locale&&(h.locale=
m.locale);var a=e.exec(b),n=a[1],d=a[4],s=a[5],t=d.split("-"),y=[],u={},v,x="";a[5]?(n=a[1],b=n+s):(s=a[4],d=h.locale,d||(d=h.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),t=d.split("-"));if(m.isBuild){y.push(b);l(f,"root",y,n,s);for(v=0;v<t.length;v++)m=t[v],x+=(x?"-":"")+m,l(f,x,y,n,s);f(y,function(){c()})}else f([b],function(a){var b=[],m;g("root",a,b,y,n,s);for(v=0;v<t.length;v++)m=t[v],x+=(x?"-":"")+m,g(x,a,b,y,n,s);f(y,function(){var p,
m,d;for(p=b.length-1;-1<p&&b[p];p--){d=b[p];m=a[d];if(!0===m||1===m)m=f(n+d+"/"+s);k(u,m)}c(u)})})}}})})();
define("orion/i18n",[],function(){return{load:function(g,l,k,e){e=e||{};var d=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,h=d.exec(g);if(h){if(!l.defined||l.defined(g))try{k(l(g));return}catch(b){}if(e.isBuild||e.isTest)k({});else if(l.specified&&!l.specified("orion/bootstrap"))k({});else{var f=h[1],c=h[3]?h[2]:"",m=h[3]||h[2];l(["orion/bootstrap"],function(a){a.startup().then(function(a){var b=a.serviceRegistry;a=b.getServiceReferences("orion.i18n.message");if(c)a.some(function(a){return g===a.getProperty("name")?
(b.getService(a).getMessageBundle().then(function(a){k(a)},function(){k({})}),!0):!1})||k({});else{var s={},t;a.forEach(function(a){var b=a.getProperty("name");if((h=d.exec(b))&&f===h[1]&&m===(h[3]||h[2]))if(c=h[3]?h[2]:""){if((a=e.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===a.toLowerCase().indexOf(c.toLowerCase()))s[c]=!0,(!l.specified||!l.specified(b))&&define(b,["orion/i18n!"+b],function(a){return a})}else t=a});!l.specified||!l.specified(g)?t?
b.getService(t).getMessageBundle().then(function(a){Object.keys(s).forEach(function(c){"undefined"===typeof a[c]&&(a[c]=s[c])});define(g,[],a);k(a)},function(){define(g,[],s);k(s)}):(define(g,[],s),k(s)):k(s)}})})}}else k(null)}}});
define("git/nls/root/gitmessages",{Compare:"Compare","View the side-by-side compare":"View the side-by-side compare","Working Directory Version":"Working Directory Version","Working Directory":"Working Directory","View the working directory version of the file":"View the working directory version of the file","Loading...":"Loading...",Repositories:"All Git Repositories",Repo:"Repositories","0 on 1 - Git":"${0} on ${1} - Git",Git:"Git","Show in eclipse.org":"Show in eclipse.org","Show this repository at eclipse.org":"Show this repository at eclipse.org",
"Show in GitHub":"Show in GitHub","Show this repository in GitHub":"Show this repository in GitHub","Commit Details":"Commit Details","No Commits":"No Commits","commit: 0":"commit: ${0}","parent: 0":"parent: ${0}","authored by 0 (1) on 2":"authored by ${0} (${1}) on ${2}","committed by 0 (1)":"committed by ${0} (${1})","Tags:":"Tags:","No Tags":"No Tags",Diffs:"Changes",More:"More","Loading git log...":"Loading git log...",local:"local",remote:"remote","Git Log for ${0} branch ${1} on ":"Git Log for ${0} branch ${1} on ",
"Git Log for ${0} branch ${1}":"Git Log for ${0} branch ${1}","Log for branch ${0} - Git":"Log for branch ${0} - Git","Log for ${0} on ${1} - Git":"Log for ${0} on ${1} - Git","View All":"View All","Error ${0}: ":"Error ${0}: ","Loading ":"Loading ",Message:"Message",Author:"Author",Date:"Date",Actions:"Actions",Branches:"Branches",Tags:"Tags",Stage:"Stage","Unstaged removal":"Unstaged removal",Unstage:"Unstage","Staged removal":"Staged removal","Unstaged change":"Unstaged change","Staged change":"Staged change",
"Unstaged add":"Unstaged add","Staged add":"Staged add",Addition:"Addition",Deletion:"Deletion","Resolve Conflict":"Resolve Conflict",Conflicting:"Conflicting","Commit message":"Commit message","Record changes in the active branch":"Record changes in the active branch",Commit:"Commit","Amend last commit":"Amend last commit"," Amend":" Amend","Rebase in progress. Choose action:":"Rebase in progress. Choose action:","Committer name:":"Committer name:","email:":"email:","Author name: ":"Author name: ",
"Select a file on the left to compare...":"Select a file on the left to compare...",Unstaged:"Unstaged",Staged:"Staged","Recent commits on":"Recent commits on","Git Status":"Git Status","Go to Git Status":"Open the Git Status page for the repository containing this file or folder.","Recent commits on ${0}":"Recent commits on ${0}","Status for ${0} - Git":"Status for ${0} - Git","Status (${0})":"Status (${0})","Getting git incoming changes...":"Getting git incoming changes...","Loading recent commits...":"Loading recent commits...",
"Show the side-by-side compare":"Show the side-by-side compare","Change Committer or Author":"Change Committer or Author","Use Default Committer and Author":"Use Default Committer and Author",Checkout:"Checkout","Checkout the file, discarding the unstaged change":"Checkout the file, discarding the unstaged change","Your changes to the file will be lost. Are you sure you want to checkout?":"Your changes to the file will be lost. Are you sure you want to checkout?","Checking out...":"Checking out...",
"Stage the change":"Stage the change","Stage the selected changes":"Stage the selected changes","Staging...":"Staging...","Checkout all the selected files, discarding all changes":"Checkout all the selected files, discarding all changes","Your changes to all the selected files will be lost. Are you sure you want to checkout?":"Your changes to all the selected files will be lost. Are you sure you want to checkout?","Save Patch":"Save Patch","Save workspace changes as a patch":"Save workspace changes as a patch",
"Unstage the change":"Unstage the change","Unstaging...":"Unstaging...",Reset:"Reset","Reset the branch, discarding all staged and unstaged changes":"Reset the branch, discarding all staged and unstaged changes","All unstaged and staged changes in the working directory and index will be discarded and cannot be recovered.":"All unstaged and staged changes in the working directory and index will be discarded and cannot be recovered.","Are you sure you want to continue?":"Are you sure you want to continue?",
"Resetting local changes...":"Resetting local changes...","Continue rebase...":"Continue rebase...","Skipping patch...":"Skipping patch...","Aborting rebase...":"Aborting rebase...","Complete log":"Complete log","local VS index":"local VS index","index VS HEAD":"index VS HEAD","Compare(${0} : ${1})":"Compare(${0} : ${1})","Loading status...":"Loading status...","Committing...":"Committing...","The committer name is required.":"The committer name is required.","The committer mail is required.":"The committer mail is required.",
"The author name is required.":"The author name is required.","The author mail is required.":"The author mail is required.",". Repository still contains conflicts.":". Repository still contains conflicts.",". Repository contains unmerged paths. Resolve conflicts first.":". Repository contains unmerged paths. Resolve conflicts first.","Rendering ${0}":"Rendering ${0}",Configuration:"Configuration"," - Git":" - Git","Repositories - Git":"Repositories - Git",Repository:"Repository","Repository Not Found":"Repository Not Found",
"No Repositories":"No Repositories","Loading repository":"Loading repository","Loading repositories":"Loading repositories","(no remote)":"(no remote)","location: ":"location: ","${0} file(s) to stage and ${1} file(s) to commit.":"${0} file(s) to stage and ${1} file(s) to commit.","Nothing to commit.":"Nothing to commit.","Nothing to push.":"Nothing to push."," commit(s) to push.":" commit(s) to push.","You have no changes to commit.":"You have no changes to commit.","You have changes to commit in your workspace!":"You have changes to commit in your workspace!",
"Rebase in progress!":"Rebase in progress!","View all local and remote tracking branches":"View all local and remote tracking branches","tracks no branch, ":"tracks no branch, ","tracks ${0}, ":"tracks ${0}, ","last modified ${0} by ${1}":"last modified ${0} by ${1}","No Remote Branches":"No Remote Branches","Rendering branches":"Rendering branches",Commits:"Commits","Getting current branch":"Getting current branch","See Full Log":"See Full Log","See the full log":"See the full log",'Getting commits for "${0}" branch':'Getting commits for "${0}" branch',
"Rendering commits":"Rendering commits","Getting outgoing commits":"Getting outgoing commits","The branch is up to date.":"The branch is up to date.","You have no outgoing or incoming commits.":"You have no outgoing or incoming commits.",") by ":") by "," (SHA ":" (SHA ","Getting tags":"Getting tags","View all tags":"View all tags"," on ":" on "," by ":" by ",Remotes:"Remotes","Rendering remotes":"Rendering remotes","No Remotes":"No Remotes","Getting confituration":"Getting confituration","View all configuration entries":"View all configuration entries",
"Unstaged addition":"Unstaged addition","Staged addition":"Staged addition"," (Rebase in Progress)":" (Rebase in Progress)",Status:"Status","Log (0)":"Log (${0})","Log (0) - 1":"Log (${0}) - ${1}","Status for ${0} - Git ":"Status for ${0} - Git ","No Unstaged Changes":"No Unstaged Changes","No Staged Changes":"No Staged Changes",'Commits for "${0}" branch':'Commits for "${0}" branch',"Add Remote":"Add Remote","Remote Name:":"Remote Name:","Remote URI:":"Remote URI:","Apply Patch":"Apply Patch","Git Repository":"Git Repository",
"Go to the git repository":"Open the Git Repository page for this file or folder.","Clone Git Repository":"Clone Git Repository","Repository URL:":"Repository URL:","Existing directory:":"Existing directory:","New folder:":"New folder:","Choose a Folder":"Choose a Folder","Commit Changes":"Commit Changes","Message:":"Message:","Amend:":"Amend:","ChangeId:":"ChangeId:","Committer Name:":"Committer Name:","Committer Email:":"Committer Email:","Author Name:":"Author Name:","Author Email:":"Author Email:",
"The commit message is required.":"The commit message is required.","Git Credentials":"Git Credentials","Username:":"Username:","Private key:":"Private key:","Passphrase (optional):":"Passphrase (optional):","commit:":"commit: ","parent:":"parent: ","branches: ":"branches: ","tags: ":"tags: "," authored by ${0} {${1}) on ${2}":" authored by ${0} (${1}) on ${2}",Content:"Content","Go to ${0} section":"Go to ${0} section","Find Commit":"Find Commit","Type the commit name (sha1):":"Type the commit name (sha1):",
Search:"Search","Searching...":"Searching...","Looking for the commit":"Looking for the commit","New Branch:":"New Branch:","No remote selected":"No remote selected","Enter a name...":"Enter a name...",OK:"OK"," [New branch]":" [New branch]","Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}.":"Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}.","Link Repository":"Link Repository","Folder name:":"Folder name:","Repository was linked to ":"Repository was linked to ",
"Checkout the current tag, creating a local branch based on its contents.":"Checkout the current tag, creating a local branch based on its contents.","Checking out tag ${0}":"Checking out tag ${0}","Checkout the branch or corresponding local branch and make it active. If the remote tracking branch does not have a corresponding local branch, the local branch will be created first.":"Checkout the branch or corresponding local branch and make it active. If the remote tracking branch does not have a corresponding local branch, the local branch will be created first.",
"Checking out branch...":"Checking out branch...","Checking out branch ${0}...":"Checking out branch ${0}...","Branch checked out.":"Branch checked out.","New Branch":"New Branch","Add a new local branch to the repository":"Add a new local branch to the repository","Branch name":"Branch name",Delete:"Delete","Delete the local branch from the repository":"Delete the local branch from the repository","Are you sure you want to delete branch ${0}?":"Are you sure you want to delete branch ${0}?","Delete the remote tracking branch from the repository":"Delete the remote tracking branch from the repository",
"Are you sure?":"Are you sure?","You're going to delete remote branch ${0} and push the change.":"You're going to delete remote branch ${0} and push the change.","Removing remote branch: ":"Removing remote branch: ","Delete Remote Branch":"Delete Remote Branch","New Remote":"New Remote","Git Remote":"Git Remote","Go to Git Remote":"Open the remote Git Log page for this file or folder.","Add a new remote to the repository":"Add a new remote to the repository","Delete the remote from the repository":"Delete the remote from the repository",
"Are you sure you want to delete remote ${0}?":"Are you sure you want to delete remote ${0}?",Pull:"Pull","Pull from the repository":"Pull from the repository","Pulling: ":"Pulling: ","Pull Git Repository":"Pull Git Repository","Git Log":"Git Log","Go to Git Log":"Open the local Git Log page for this file or folder.","Open the log for the branch":"Open the log for the branch","Open the log for the repository":"Open the log for the repository","Open the status for the repository":"Open the status for the repository",
ShowInEditor:"Show in Editor",ShowInEditorTooltip:"Show the repository folder in the editor","Compare With Each Other":"Compare With Each Other","Compare With Working Tree":"Compare With Working Tree",Open:"Open",Fetch:"Fetch","Fetch from the remote":"Fetch from the remote","Password:":"Password:","User Name:":"User Name:","Fetching remote: ":"Fetching remote: ","Force Fetch":"Force Fetch","Fetch from the remote branch into your remote tracking branch overriding its current content":"Fetch from the remote branch into your remote tracking branch overriding its current content",
"You're going to override content of the remote tracking branch. This can cause the branch to lose commits.":"You're going to override content of the remote tracking branch. This can cause the branch to lose commits.",Merge:"Merge","Merge the content from the branch to your active branch":"Merge the content from the branch to your active branch",". Go to ${0}.":". Go to ${0}.","Git Status page":"Git Status page",Rebase:"Rebase","Rebase your commits by removing them from the active branch, starting the active branch again based on the latest state of the selected branch ":"Rebase your commits by removing them from the active branch, starting the active branch again based on the latest state of the selected branch ",
"Rebase on top of ":"Rebase on top of ",". Some conflicts occurred. Please resolve them and continue, skip patch or abort rebasing":". Some conflicts occurred. Please resolve them and continue, skip patch or abort rebasing",". Repository state is invalid (i.e. already during rebasing)":". Repository state is invalid (i.e. already during rebasing)",". Repository contains unmerged paths":". Repository contains unmerged paths",". Repository contains pending changes. Please commit or stash them":". Repository contains pending changes. Please commit or stash them",
"Rebase your commits by removing them from the active branch, ":"Rebase your commits by removing them from the active branch, ","starting the active branch again based on the latest state of '":"starting the active branch again based on the latest state of '","and applying each commit again to the updated active branch.":"and applying each commit again to the updated active branch.","Push All":"Push All","Push commits and tags from your local branch into the remote branch":"Push commits and tags from your local branch into the remote branch",
"Push Branch":"Push Branch","Push commits without tags from your local branch into the remote branch":"Push commits without tags from your local branch into the remote branch","Push for Review":"Push for Review","Push commits to Gerrit Code Review":"Push commits to Gerrit Code Review","Force Push Branch":"Force Push Branch","Push commits without tags from your local branch into the remote branch overriding its current content":"Push commits without tags from your local branch into the remote branch overriding its current content",
"Pushing remote: ":"Pushing remote: ","Choose Branch":"Choose Branch","Force Push All":"Force Push All","Push commits and tags from your local branch into the remote branch overriding its current content":"Push commits and tags from your local branch into the remote branch overriding its current content","You're going to override content of the remote branch. This can cause the remote repository to lose commits.":"You're going to override content of the remote branch. This can cause the remote repository to lose commits.",
"\x3c Previous Page":"\x3c Previous Page","Show previous page of git log":"Show previous page of git log","Show previous page of git tags":"Show previous page of git tags","Next Page \x3e":"Next Page \x3e","Show next page of git log":"Show next page of git log","Show next page of git tags":"Show next page of git tags","Push from your local branch into the selected remote branch":"Push from your local branch into the selected remote branch","Reset your active branch to the state of the selected branch. Discard all staged and unstaged changes.":"Reset your active branch to the state of the selected branch. Discard all staged and unstaged changes.",
GitResetIndexConfirm:"The content of your active branch will be replaced with ${0}. All unstaged and staged changes will be discarded and cannot be recovered. Are you sure?","Resetting index...":"Resetting index...","Name:":"Name:",Tag:"Tag","Create a tag for the commit":"Create a tag for the commit","Tag name":"Tag name","Delete the tag from the repository":"Delete the tag from the repository","Are you sure you want to delete tag ${0}?":"Are you sure you want to delete tag ${0}?","Cherry-Pick":"Cherry-Pick",
"Apply the change introduced by the commit to your active branch":"Apply the change introduced by the commit to your active branch","Nothing changed.":"Nothing changed.",". Some conflicts occurred":". Some conflicts occurred","Fetch from the remote branch into your remote tracking branch":"Fetch from the remote branch into your remote tracking branch","Fetch Git Repository":"Fetch Git Repository",Push:"Push","Push from your local branch into the remote branch":"Push from your local branch into the remote branch",
"Push Git Repository":"Push Git Repository","Key:":"Key:","Value:":"Value:","New Configuration Entry":"New Configuration Entry",Edit:"Edit","Edit the configuration entry":"Edit the configuration entry","Delete the configuration entry":"Delete the configuration entry","Are you sure you want to delete ${0}?":"Are you sure you want to delete ${0}?","Clone Repository":"Clone Repository","Clone an existing Git repository to a folder":"Clone an existing Git repository to a folder","Cloning repository: ":"Cloning repository: ",
"Init Repository":"Init Repository","Create a new Git repository in a new folder":"Create a new Git repository in a new folder","Initializing repository: ":"Initializing repository: ","Init Git Repository":"Init Git Repository","Delete the repository":"Delete the repository","Are you sure you want do delete ${0} repositories?":"Are you sure you want do delete ${0} repositories?","Apply a patch on the selected repository":"Apply a patch on the selected repository","Show content":"Show content","Commit name:":"Commit name:",
"Open Commit":"Open Commit","Open the commit with the given name":"Open the commit with the given name","No commits found":"No commits found","Staging changes":"Staging changes","Commit message:":"Commit message:","Committing changes":"Committing changes","Fetching previous commit message":"Fetching previous commit message","Resetting local changes":"Resetting local changes","Checkout files, discarding all changes":"Checkout files, discarding all changes","Show Patch":"Show Patch","Show workspace changes as a patch":"Show workspace changes as a patch",
Continue:"Continue","Contibue Rebase":"Contibue Rebase","Skip Patch":"Skip Patch",Abort:"Abort","Abort Rebase":"Abort Rebase","Your changes to the selected files will be discarded and cannot be recovered.":"Your changes to the selected files will be discarded and cannot be recovered.","Active Branch Log":"Git Log (Active Branch)","Show the log for the active local branch":"Show the log for the active local branch","Remote Branch Log":"Git Log (Remote Branch)","Show the log for the corresponding remote tracking branch":"Show the log for the corresponding remote tracking branch",
"See Full Status":"See Full Status","See the status":"See the status","Choose target location":"Choose target location","Default target location":"Default target location","Change...":"Change...","Merge Squash":"Merge Squash","Squash the content of the branch to the index":"Squash the content of the branch to the index","Local Branch Name:":"Local Branch Name:","Filter items":"Filter items","Filter remote branches":"Filter remote branches","Paste link in email or IM":"Paste link in email or IM","Show Commit in GitHub":"Show Commit in GitHub",
"Show Repository in GitHub":"Show Repository in GitHub","Show this commit in GitHub":"Show this commit in GitHub","Show Commit in eclipse.org":"Show Commit in eclipse.org","Show this commit in eclipse.org":"Show this commit in eclipse.org","Show Repository in eclipse.org":"Show Repository in eclipse.org","Show this repository in eclipse.org":"Show this repository in eclipse.org","Ask for review":"Ask for review","Ask for review tooltip":"Send email with request for commit review","Reviewer name":"Reviewer name",
"Contribution Review Request":"Contribution Review Request","Send the link to the reviewer":"Send the link to the reviewer","Private key file (optional):":"Private key file (optional):","Don't prompt me again:":"Don't prompt me again:","Your private key will be saved in the browser for further use":"Your private key will be saved in the browser for further use","Loading Contribution Review Request...":"Loading Contribution Review Request...","The commit can be found in the following repositories":"The commit can be found in the following repositories",
"Try to update your repositories":"Try to update your repositories","Create new repository":"Create new repository","Attach the remote to one of your existing repositories":"Attach the remote to one of your existing repositories","You are reviewing contribution ${0} from ${1}":"You are reviewing contribution ${0} from ${1}","Unfortunately the commit can not be found in your workspace. To see it try one of the following: ":"Unfortunately the commit can not be found in your workspace. To see it try one of the following: ",
"To review the commit you can also:":"To review the commit you can also:","Contribution Review Request for ${0} on ${1}":"Contribution Review Request for ${0} on ${1}","Failing paths: ${0}":"Failing paths: ${0}","Problem while performing the action":"Problem while performing the action","Go to the Orion repositories page to provide a git repository URL. Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL. Once the repository is created, it will appear in the Navigator.",
"URL:":"URL:","File:":"File:",Submit:"Submit","git url:":"git url: ",Revert:"Revert","Revert changes introduced by the commit into your active branch":"Revert changes introduced by the commit into your active branch",". Could not revert into active branch":". Could not revert into active branch",Login:"Login","Authentication required for: ${0}. ${1} and re-try the request.":"Authentication required for: ${0}. ${1} and re-try the request.","Signed-off-by: ":"Signed-off-by: ","Change-Id: ":"Change-Id: "});
define("git/nls/gitmessages",["orion/i18n!git/nls/gitmessages","git/nls/root/gitmessages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
(function(g,l){"function"===typeof define&&define.amd?define("orion/Deferred",l):"object"===typeof exports?module.exports=l():(g.orion=g.orion||{},g.orion.Deferred=l())})(this,function(){function g(){for(var b;b=d.shift();)b();h=!1}function l(f){d.push(f);h||(h=!0,b())}function k(b){return function(c){b(c)}}function e(){function b(){for(var a;a=h.shift();){var c=a.deferred,f="fulfilled"===d?"resolve":"reject";a=a[f];if("function"===typeof a)try{var m=a(n),e=m&&("object"===typeof m||"function"===typeof m)&&
m.then;if("function"===typeof e)if(m===c.promise)c.reject(new TypeError);else{var g=m.cancel;"function"===typeof g?c._parentCancel=g.bind(m):delete c._parentCancel;e.call(m,k(c.resolve),k(c.reject),k(c.progress))}else c.resolve(m)}catch(t){c.reject(t)}else c[f](n)}}function c(a){delete g._parentCancel;d="rejected";n=a;h.length&&l(b)}function m(a){function k(a){return function(c){(!d||"assumed"===d)&&a(c)}}delete g._parentCancel;try{var v=a&&("object"===typeof a||"function"===typeof a)&&a.then;if("function"===
typeof v)if(a===g)c(new TypeError);else{d="assumed";var x=a&&a.cancel;if("function"!==typeof x){var z=new e;a=z.promise;try{v(z.resolve,z.reject,z.progress)}catch(A){z.reject(A)}x=a.cancel;v=a.then}n=a;v.call(a,k(m),k(c));g._parentCancel=x.bind(a)}else d="fulfilled",n=a,h.length&&l(b)}catch(C){k(c)(C)}}function a(){var a=g._parentCancel;a?(delete g._parentCancel,a()):d||(a=Error("Cancel"),a.name="Cancel",c(a))}var n,d,h=[],g=this;this.resolve=function(a){d||m(a);return g};this.reject=function(a){d||
c(a);return g};this.progress=function(a){d||h.forEach(function(c){if(c.progress)try{c.progress(a)}catch(b){}});return g.promise};this.cancel=function(){g._parentCancel?setTimeout(a,0):a();return g};this.then=function(a,c,m){var n=new e;n._parentCancel=g.promise.cancel;h.push({resolve:a,reject:c,progress:m,deferred:n});("fulfilled"===d||"rejected"===d)&&l(b);return n.promise};this.promise={then:g.then,cancel:g.cancel}}var d=[],h=!1,b=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var b=
process.nextTick;return function(){b(g)}}if("function"===typeof MutationObserver){var c=document.createElement("div");(new MutationObserver(g)).observe(c,{attributes:!0});return function(){c.setAttribute("class","_tick")}}return function(){setTimeout(g,0)}}();e.all=function(b,c){function m(a,c){h||(d[a]=c,0===--n&&g.resolve(d))}function a(a,b){if(!h){if(c)try{m(a,c(b));return}catch(f){b=f}g.reject(b)}}var n=b.length,d=[],h=!1,g=new e;g.then(void 0,function(){h=!0;b.forEach(function(a){a.cancel&&a.cancel()})});
0===n?g.resolve(d):b.forEach(function(c,b){c.then(m.bind(void 0,b),a.bind(void 0,b))});return g.promise};e.when=function(b,c,m,a){var d;b&&"function"===typeof b.then||(d=new e,d.resolve(b),b=d.promise);return b.then(c,m,a)};return e});
define("orion/EventTarget",[],function(){function g(){this._namedListeners={}}g.prototype={dispatchEvent:function(g){if(!g.type)throw Error("unspecified type");var k=this._namedListeners[g.type];k&&k.forEach(function(e){try{"function"===typeof e?e(g):e.handleEvent(g)}catch(d){"undefined"!==typeof console&&console.log(d)}});return!g.defaultPrevented},addEventListener:function(g,k){if("function"===typeof k||k.handleEvent)this._namedListeners[g]=this._namedListeners[g]||[],this._namedListeners[g].push(k)},
removeEventListener:function(g,k){var e=this._namedListeners[g];if(e)for(var d=0;d<e.length;d++)if(e[d]===k){1===e.length?delete this._namedListeners[g]:e.splice(d,1);break}}};g.prototype.constructor=g;g.attach=function(l){var k=new g;l.dispatchEvent=k.dispatchEvent.bind(k);l.addEventListener=k.addEventListener.bind(k);l.removeEventListener=k.removeEventListener.bind(k)};return g});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(g,l){function k(b,c,m){this._properties=m||{};this._properties["service.id"]=b;this._properties.objectClass=c;this._properties["service.names"]=c}function e(b,c,m){this._serviceId=b;this._serviceReference=c;this._internalRegistry=m}function d(b,c){function m(a){return function(){var m;try{if(!c())throw Error("Service was unregistered");var d=b[a].apply(b,Array.prototype.slice.call(arguments));if(d&&"function"===typeof d.then)return d;
m=new g;m.resolve(d)}catch(e){m=new g,m.reject(e)}return m.promise}}for(var a in b)"function"===typeof b[a]&&(this[a]=m(a))}function h(b,c){this.type=b;this.serviceReference=c}function b(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new l;var b=this;this._internalRegistry={isRegistered:function(c){return b._entries[c]?!0:!1},unregisterService:function(c){var m=b._entries[c];if(!m)throw Error("Service has already been unregistered: "+c);var a=m.reference;b._serviceEventTarget.dispatchEvent(new h("unregistering",
a));b._entries[c]=null;a.getProperty("objectClass").forEach(function(c){for(var m=b._namedReferences[c],d=0;d<m.length;d++)if(m[d]===a){1===m.length?delete b._namedReferences[c]:m.splice(d,1);break}})},modifyService:function(c){var m=b._entries[c];if(!m)throw Error("Service not found while trying to send modified event: "+c);b._serviceEventTarget.dispatchEvent(new h("modified",m.reference))}}}k.prototype={getPropertyKeys:function(){var b=[],c;for(c in this._properties)this._properties.hasOwnProperty(c)&&
b.push(c);return b},getProperty:function(b){return this._properties[b]}};k.prototype.constructor=k;e.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(b){var c=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=c.objectClass;b["service.names"]=c["service.names"];this._internalRegistry.modifyService(this._serviceId)}};e.prototype.constructor=e;b.prototype={getService:function(b){var c;if("string"===typeof b)(b=this._namedReferences[b])&&b.some(function(b){c=this._entries[b.getProperty("service.id")].service;return!!c},this);else if(b=this._entries[b.getProperty("service.id")])c=b.service;return c||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var c=[];this._entries.forEach(function(b){b&&c.push(b.reference)});return c},registerService:function(b,c,m){if("undefined"===typeof c||null===c)throw Error("invalid service");"string"===typeof b?b=[b]:Array.isArray(b)||(b=[]);var a=this._entries.length,n=new k(a,b,m),q=this._namedReferences;b.forEach(function(a){q[a]=q[a]||[];q[a].push(n)});b=new d(c,this._internalRegistry.isRegistered.bind(null,a));this._entries.push({reference:n,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new h("registered",
n));return new e(a,n,b)},addEventListener:function(b,c){this._serviceEventTarget.addEventListener(b,c)},removeEventListener:function(b,c){this._serviceEventTarget.removeEventListener(b,c)}};b.prototype.constructor=b;return{ServiceRegistry:b}});
define("orion/xhr",["orion/Deferred"],function(g){function l(g,e,d,h){var b="undefined"!==typeof d.response?d.response:d.responseText,f;try{f=d.status}catch(c){f=0}g={args:e,response:b,responseText:"string"===typeof b?b:null,status:f,url:g,xhr:d};"undefined"!==typeof h&&(g.error=h);return g}return function(k,e,d){d=d||{};var h=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new g,f=d.headers||{},c=d.log||!1,m;"undefined"===typeof f["X-Requested-With"]&&(f["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof d.data&&("POST"===k||"PUT"===k))m=d.data;var a=!1,n=!1;b.promise.then(void 0,function(c){a=!0;!n&&c instanceof Error&&"Cancel"===c.name&&h.abort()});h.onabort=function(){n=!0;if(!a){var c=Error("Cancel");c.name="Cancel";b.reject(c)}};h.onload=function(){var a=l(e,d,h);200<=h.status&&400>h.status?b.resolve(a):(b.reject(a),c&&"undefined"!==typeof console&&console.log(Error(h.statusText)))};h.onerror=function(){var a=l(e,d,h);b.reject(a);c&&"undefined"!==typeof console&&console.log(Error(h.statusText))};
h.onprogress=function(a){a.xhr=h;b.progress(a)};try{h.open(k,e,!0);"string"===typeof d.responseType&&(h.responseType=d.responseType);if("number"===typeof d.timeout)if("number"===typeof h.timeout)h.timeout=d.timeout,h.addEventListener("timeout",function(a){b.reject(l(e,d,h,"Timeout exceeded"))});else{var q=setTimeout(function(){b.reject(l(e,d,h,"Timeout exceeded"))},d.timeout);b.promise.then(clearTimeout.bind(null,q),clearTimeout.bind(null,q))}Object.keys(f).forEach(function(a){h.setRequestHeader(a,
f[a])});h.send(m||null)}catch(s){b.reject(l(e,d,h,s))}return b.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(g,l,k){function e(c,a){this._name=c;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function d(c,a){return{get:function(b,f){if(0===a)return null;var d=localStorage.getItem(c+b);if(null===d)return null;d=JSON.parse(d);return f||-1===a||d._expires&&d._expires>(new Date).getTime()?(delete d._expires,d):null},set:function(b,f){if(0!==a)if(-1!==a&&(f._expires=(new Date).getTime()+
1E3*a),0===Object.keys(f).length)localStorage.removeItem(c+b);else{var d=JSON.stringify(f);localStorage.setItem(c+b,d);delete f._expires}},remove:function(a){localStorage.removeItem(c+a)}}}function h(c){this._currentPromises={};this._cache=new d("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=c.getServiceReferences("orion.core.preference.provider");0<a.length&&(this._service=c.getService(a[0]))}return!!this._service}}function b(c){this._location=
c;this._currentPromise=null;this._cache=new d("/orion/preferences/default",3600)}function f(){this._cache=new d("/orion/preferences/local",-1)}function c(c,a){this._userProvider=new h(c);this._localProvider=new f;a=a||"defaults.pref";-1===a.indexOf("://")&&(a=g.toUrl(a));this._defaultsProvider=new b(a);this._serviceRegistration=c.registerService("orion.core.preference",this)}e.prototype={_flush:function(){for(var c=[],a=0;a<this._stores.length;++a){var b=this._stores[a];-1!==this._dirty.indexOf(b)&&
c.push(this._providers[a].put(this._name,b));if(this._pendingDeletes[a]&&0<this._pendingDeletes[a].length){for(b=0;b<this._pendingDeletes[a].length;b++)c.push(this._providers[a].remove(this._name,this._pendingDeletes[a][b]));delete this._pendingDeletes[a]}}this._dirty=[];return l.all(c)},_scheduleFlush:function(c){c&&-1===this._dirty.indexOf(c)&&this._dirty.push(c);this._flushPending||(this._flushPending=!0,window.setTimeout(function(){this._flushPending&&(this._flushPending=!1,this._flush())}.bind(this),
0))},_getCached:function(){if(!this._cached){this._cached={};for(var c=0;c<this._stores.length;++c){var a=this._stores[c],b;for(b in a)a.hasOwnProperty(b)&&"undefined"===typeof this._cached[b]&&(this._cached[b]=a[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(c){return this._getCached()[c]},put:function(c,a){if(0!==this._stores.length){var b=this._stores[0];b[c]!==a&&(b[c]=a,this._cached=null,this._scheduleFlush(b))}},remove:function(c){for(var a=0;a<
this._stores.length;++a){var b=this._stores[a];if(b.hasOwnProperty(c))return delete b[c],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(c),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var c=0;c<this._stores.length;++c)this._stores[c]={},this._scheduleFlush(this._stores[c]);this._cached=null},sync:function(c){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,b=[],f=0;f<this._providers.length;++f)b.push(this._providers[f].get(this._name,
c).then(function(c){return function(b){a._stores[c]=b}}(f)));return l.all(b).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};h.prototype={get:function(c,a){if(this._currentPromises[c])return this._currentPromises[c];var b=new l,f=null;a?this._cache.remove(c):f=this._cache.get(c);if(null!==f)b.resolve(f);else{this._currentPromises[c]=b;var d=this;this._service.get(c).then(function(a){d._cache.set(c,a);delete d._currentPromises[c];b.resolve(a)},function(a){404===a.status?
(a={},d._cache.set(c,a),delete d._currentPromises[c],b.resolve(a)):(delete d._currentPromises[c],b.resolve(d._cache.get(c,!0)||{}))})}return b},put:function(c,a){this._cache.set(c,a);return this._service.put(c,a)},remove:function(c,a){var b=this._cache.get(c);delete b[a];this._cache.set(c,b);return this._service.remove(c,a)}};b.prototype={get:function(c,a){if(this._currentPromise)return this._currentPromise;var b=new l,f=null;a?this._cache.remove(c):f=this._cache.get(c);if(null!==f)b.resolve(f);else{this._currentPromise=
b;var d=this;k("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=JSON.parse(a.response);d._cache.set(c,a[c]||{});d._currentPromise=null;b.resolve(a[c]||{})},function(a){401===a.xhr.status||404===a.xhr.status?(d._cache.set(c,{}),d._currentPromise=null,b.resolve({})):(d._currentPromise=null,a=d._cache.get(c,!0),null!==a?b.resolve(a[c]||{}):b.resolve({}))})}return b},put:function(c,a){var b=new l;b.resolve();return b},remove:function(c,a){var b=this._cache.get(c);
delete b[a];this.put(c,b)}};f.prototype={get:function(c){var a=new l;c=this._cache.get(c);null!==c?a.resolve(c):a.resolve({});return a},put:function(c,a){var b=new l;this._cache.set(c,a);b.resolve();return b},remove:function(c,a){var b=this._cache.get(c);delete b[a];this.put(c,b)}};c.DEFAULT_SCOPE=1;c.LOCAL_SCOPE=2;c.USER_SCOPE=4;c.prototype={listenForChangedSettings:function(b,a,f){if(!a||"number"!==typeof a||7<a||1>a)f=a,a=c.DEFAULT_SCOPE|c.LOCAL_SCOPE|c.USER_SCOPE;window.addEventListener("storage",
f,!1);return 0!==(c.USER_SCOPE&a)?"/orion/preferences/user"+b:0!==(c.LOCAL_SCOPE&a)?"/orion/preferences/local"+b:"/orion/preferences/default"+b},getPreferences:function(b,a){if(!a||"number"!==typeof a||7<a||1>a)a=c.DEFAULT_SCOPE|c.LOCAL_SCOPE|c.USER_SCOPE;var f=[];c.USER_SCOPE&a&&this._userProvider.available()&&f.push(this._userProvider);c.LOCAL_SCOPE&a&&f.push(this._localProvider);c.DEFAULT_SCOPE&a&&f.push(this._defaultsProvider);var d=new e(b,f);return d.sync().then(function(){return d})},getSetting:function(c,
a,b){for(var f,d=0;d<c.length;d++)if(c[d].label===a)for(var e=0;e<c[d].data.length;e++)if(c[d].data[e].label===b){f=c[d].data[e].value;break}return f}};return{PreferencesService:c}});
(function(){function g(a){if("string"!==typeof a)throw new TypeError;}function l(a){return a?a.split("\x26"):[]}function k(a){return 0===a.length?"":a.join("\x26")}function e(a){var c=/([^=]*)(?:=?)(.*)/.exec(a);a=c[1]?decodeURIComponent(c[1]):"";c=c[2]?decodeURIComponent(c[2]):"";return[a,c]}function d(a){var c=encodeURIComponent(a[0]);a[1]&&(c+="\x3d"+encodeURIComponent(a[1]));return c}function h(a,c){var b="",p=[],f=0;return{next:function(){b!==a.query&&(b=a.query,p=l(b));if(f<p.length){var m=
e(p[f++]);switch(c){case "keys":return m[0];case "values":return m[1];case "keys+values":return[m[0],m[1]];default:throw new TypeError;}}throw r;}}}function b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function f(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function c(a){var c=[];a.split("/").forEach(function(a){".."===a?c.pop():"."!==a&&c.push(a)});return c.join("/")}function m(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function a(a,b){if("string"!==
typeof a)throw new TypeError;a=m(a);var p=t.exec(a);if(!p)return null;var d={};d.scheme=p[1]||"";if(d.scheme&&!u.test(d.scheme))return null;var r=p[2];if(r&&(r=y.exec(r),d.userinfo=r[1],d.host=r[2],d.port=r[3],d.port&&!v.test(d.port)))return null;d.path=p[3];d.query=p[4];d.fragment=p[5];!d.scheme&&b&&(d.scheme=b.scheme,!d.host&&b.host&&(d.userinfo=b.userinfo,d.host=b.host,d.port=b.port,d.pathRelative=!0));d.pathRelative&&(d.path?"/"!==d.path[0]&&(p=/^(.*\/)[^\/]*$/.exec(b.path)[1]||"/",d.path=p+d.path):
d.path=b.path);d.scheme&&(d.scheme=d.scheme.toLowerCase());d.port&&(d.port=f(d.port));d.host&&d.path&&(d.path=c(d.path));return d}function n(c,p){var f;if(p){p=p.href||p;f=a(p);if(!f||!f.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:f})}f=a(c,f);if(!f)throw new SyntaxError;Object.defineProperty(this,"_input",{value:c,writable:!0});Object.defineProperty(this,"_url",{value:f,writable:!0});var d=new b(this);Object.defineProperty(this,"query",{get:function(){return this._url?
d:null},enumerable:!0})}try{var q;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(q=new window.URL("http://www.w3.org?q")).protocol&&q.query)return}catch(s){}var t=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,y=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,u=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,v=/^\d*$/,x=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,z=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,A=/^([^?#\s]*)$/,C=/^([^\s]*)$/,p=/^\S*$/,w=/([^:]*):?(.*)/,r="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),B={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){g(a);var c;l(this._url.query).some(function(b){b=e(b);if(b[0]===a)return c=b[1],!0});return c},enumerable:!0},set:{value:function(a,c){g(a);g(c);var b=l(this._url.query);b.some(function(p,f){var m=e(p);if(m[0]===a)return m[1]=c,b[f]=d(m),!0})||b.push(d([a,c]));this._url.query=k(b)},enumerable:!0},has:{value:function(a){g(a);
return l(this._url.query).some(function(c){if(e(c)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){g(a);var c=l(this._url.query),b=c.filter(function(c){return e(c)[0]!==a});return b.length!==c.length?(this._url.query=k(b),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,c){if("function"!==typeof a)throw new TypeError;var b=h(this._url,"keys+values");try{for(;;){var p=b.next();a.call(c,p[1],p[0],this)}}catch(f){if(f!==r)throw f;
}},enumerable:!0},keys:{value:function(){return h(this._url,"keys")},enumerable:!0},values:{value:function(){return h(this._url,"values")},enumerable:!0},items:{value:function(){return h(this._url,"keys+values")}},size:{get:function(){return l(this._url.query).length},enumerable:!0},getAll:{value:function(a){g(a);var c=[];l(this._url.query).forEach(function(b){b=e(b);b[0]===a&&c.push(b[1])});return c},enumerable:!0},append:{value:function(a,c){g(a);g(c);var b=l(this._url.query);b.push(d([a,c]));this._url.query=
k(b)},enumerable:!0}});Object.defineProperties(n.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var c=a.scheme?a.scheme+":":"";a.host&&(c+="//",a.userinfo&&(c+=a.userinfo+"@"),c+=a.host,a.port&&(c+=":"+a.port));c+=a.path;a.query&&(c+="?"+a.query);a.fragment&&(c+="#"+a.fragment);a=c}else a=this._input;return a},set:function(c){g(c);this._input=c;this._url=a(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){g(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||u.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){g(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=w.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){g(a);if(this._url){var c=
w.exec(this._userinfo);a=[encodeURIComponent(a||"")];c[2]&&a.push(c[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=w.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){g(a);if(this._url){var c=[w.exec(this._userinfo)[1]||""];a&&c.push(encodeURIComponent(a));this._userinfo=c.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){g(a);if(this._url&&(a=z.exec(a)))this._url.host=a[1],this._url.port=f(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){g(a);this._url&&x.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===B[this.protocol]&&(a="");return a},set:function(a){g(a);this._url&&v.exec(a)&&(this._url.port=f(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){g(a);
this._url&&A.exec(a)&&(this._url.host&&a&&"/"!==a[0]&&(a="/"+a),this._url.path=a?c(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){g(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),C.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){g(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),p.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((q=window.URL||window.webkitURL)&&q.createObjectURL)Object.defineProperty(n,"createObjectURL",{value:q.createObjectURL.bind(q),enumerable:!1}),Object.defineProperty(n,"revokeObjectURL",{value:q.revokeObjectURL.bind(q),enumerable:!1});window.URL=n})();define("orion/URL-shim",[],function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(g,l,k){function e(a,c){var b=Object.keys(a),f=Object.keys(c);if(b.length!==f.length)return!1;b.sort();f.sort();for(var d=0,m=b.length;d<m;d++){var n=b[d];if(n!==f[d])return!1;var e=a[n],n=c[n];if(e!==n&&JSON.stringify(e)!==JSON.stringify(n))return!1}return!0}function d(a){if(-1===a.indexOf("://"))try{return(new URL(a,location.href)).href}catch(c){}return a}function h(a){var c=null,b={key:function(b){return(c=
c||Object.keys(a))[b]},getItem:function(c){return a[c]},setItem:function(b,f){a[b]=f;c=null},removeItem:function(b){delete a[b];c=null},clear:function(){(c=c||Object.keys(a)).forEach(function(c){delete a[c]}.bind(this));c=null}};Object.defineProperty(b,"length",{get:function(){return(c=c||Object.keys(a)).length}});return b}function b(a,c){if(c&&c instanceof XMLHttpRequest){var b,f;try{b=c.status,f=c.statusText}catch(d){b=0,f=""}return{status:b||0,statusText:f}}return c}function f(a){var c=a?JSON.parse(JSON.stringify(a,
b)):a;a instanceof Error&&(c.__isError=!0,c.message=c.message||a.message,c.name=c.name||a.name);return c}function c(a,c){this.type=a;this.plugin=c}function m(a,c){this.__objectId=a;this.__methods=c}function a(a,b,d){function n(a){O&&d.postMessage(a,O)}function h(a){if(!O)return(new g).reject(Error("plugin not connected"));a.id=String(T++);var c=new g;X[a.id]=c;c.then(null,function(c){"active"===E&&c instanceof Error&&"Cancel"===c.name&&n({requestId:a.id,method:"cancel",params:c.message?[c.message]:
[]})});var b=Object.prototype.toString;a.params.forEach(function(p,f){if("[object Object]"===b.call(p)&&!(p instanceof m)){var d,r;for(d in p)"[object Function]"===b.call(p[d])&&(r=r||[],r.push(d));if(r){var n=V++;S[n]=p;d=function(){delete S[n]};c.then(d,d);a.params[f]=new m(n,r)}}});d.postMessage(a,O);return c.promise}function k(a,c){a||0===a?n({id:a,result:null,error:c}):console.log(c)}function x(a,c,b,p){p.forEach(function(a,c){if(a&&"undefined"!==typeof a.__objectId){var b={};a.__methods.forEach(function(c){b[c]=
function(){return h({objectId:a.__objectId,method:c,params:Array.prototype.slice.call(arguments)})}});p[c]=b}});var d=void 0===typeof a?null:{id:a,result:null,error:null};try{var m=b.apply(c,p);d&&(m&&"function"===typeof m.then?(W[a]=m,m.then(function(c){delete W[a];d.result=c;n(d)},function(c){W[a]&&(delete W[a],d.error=f(c),n(d))},function(){n({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=m,n(d)))}catch(r){d&&(d.error=f(r),n(d))}}function z(a){try{if(a.method){var c=
a.method,b=a.params||[];if("serviceId"in a){var p=$[a.serviceId];p||k(a.id,"service not found");c in p?x(a.id,p,p[c],b):k(a.id,"method not found")}else if("objectId"in a){var f=S[a.objectId];f||k(a.id,"object not found");c in f?x(a.id,f,f[c],b):k(a.id,"method not found")}else if("requestId"in a){var m=W[a.requestId];m&&"cancel"===c&&m.cancel&&m.cancel.apply(m,b)}else if("responseId"in a){var n=X[a.responseId];n&&"progress"===c&&n.progress&&n.progress.apply(n,b)}else if("plugin"===a.method){var w=
a.params[0];P({headers:w.headers,services:w.services}).then(function(){H&&H.resolve(r)})}else if("timeout"===a.method)H&&H.reject(a.error);else throw Error("Bad method: "+a.method);}else{var e=X[String(a.id)];delete X[String(a.id)];if(a.error){var q=d.handleServiceError(r,a.error);e.reject(q)}else e.resolve(a.result)}}catch(h){console.log("Plugin._messageHandler "+h)}}function A(a){var c={};if(a.methods&&(a.methods.forEach(function(b){c[b]=function(){var c={serviceId:a.serviceId,method:b,params:Array.prototype.slice.call(arguments)};
return"active"===E?h(c):r.start({"transient":!0}).then(function(){return h(c)})}}),c.addEventListener&&c.removeEventListener)){var b=new l,p=V++;S[p]={handleEvent:b.dispatchEvent.bind(b)};var f=new m(p,["handleEvent"]),d=c.addEventListener;c.addEventListener=function(a,c){b._namedListeners[a]||d(a,f);b.addEventListener(a,c)};var n=c.removeEventListener;c.removeEventListener=function(a,c){b.removeEventListener(a,c);b._namedListeners[a]||n(a,f)}}return c}function C(c){var b=JSON.parse(JSON.stringify(c.properties));
b.__plugin__=a;c=c.names||c.type||[];Array.isArray(c)||(c=[c]);b.objectClass=c;return b}function p(a){var c=A(a),b=C(a),b=d.registerService(a.names||a.type,c,b);K[a.serviceId]={registration:b,proxy:c}}function w(){d.persist(a,{created:B,headers:D,services:I,autostart:F,lastModified:J})}var r=this;b=b||{};var B=b.created||(new Date).getTime(),D=b.headers||{},I=b.services||[],F=b.autostart,J=b.lastModified||0,E="installed",G,H,O,Q,K={},T=0,V=0,W={},X={},S={},$={},P;this._persist=w;this._resolve=function(){E=
"resolved";d.dispatchEvent(new c("resolved",r))};this._getAutostart=function(){return F};this._getCreated=function(){return B};this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(D))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return J};this.getServiceReferences=function(){var a=[];Object.keys(K).forEach(function(c){a.push(K[c].registration.getReference())});
return a};this.setParent=function(a){return Q!==a?(Q=a,r.stop({"transient":!0}).then(function(){if("started"===F)return r.start({"transient":!0});if("lazy"===F)return r.start({lazy:!0,"transient":!0})})):(new g).resolve()};this.getState=function(){return E};this.start=function(b){if("uninstalled"===E)return(new g).reject(Error("Plugin is uninstalled"));if(G)return G.promise.then(this.start.bind(this,b));if("active"===E)return(new g).resolve();if(!b||!b.transient){var f=b&&b.lazy?"lazy":"started";
f!==F&&(F=f,w())}f=d.getState();if("starting"!==f&&"active"!==f)return b.transient?(new g).reject(Error("start transient error")):(new g).resolve();if("installed"===E)try{this._resolve()}catch(m){return(new g).reject(m)}"resolved"===E&&I.forEach(function(a){p(a)});if(b&&b.lazy)return"starting"!==E&&(E="starting",d.dispatchEvent(new c("lazy activation",r))),(new g).resolve();var n=new g;G=n;E="starting";d.dispatchEvent(new c("starting",r));H=new g;O=d.connect(a,z,Q);H.then(function(){H=null;E="active";
d.dispatchEvent(new c("started",r));G=null;n.resolve()},function(){H=null;E="stopping";d.dispatchEvent(new c("stopping",r));Object.keys(K).forEach(function(a){K[a].registration.unregister();delete K[a]});d.disconnect(O);O=null;E="resolved";G=null;d.dispatchEvent(new c("stopped",r));n.reject(Error("plugin activation error"))});return n.promise};this.stop=function(a){if("uninstalled"===E)return(new g).reject(Error("Plugin is uninstalled"));if(G)return G.promise.then(this.stop.bind(this,a));if((!a||
!a.transient)&&"stopped"!==F)F="stopped",w();if("active"!==E&&"starting"!==E)return(new g).resolve();G=a=new g;E="stopping";d.dispatchEvent(new c("stopping",r));Object.keys(K).forEach(function(a){K[a].registration.unregister();delete K[a]});O&&(d.disconnect(O),O=null);E="resolved";G=null;d.dispatchEvent(new c("stopped",r));a.resolve();return a.promise};P=function(b){if("uninstalled"===E)return(new g).reject(Error("Plugin is uninstalled"));if(!b)return 0===J&&(J=(new Date).getTime(),w()),d.loadManifest(a).then(P);
var f=D,m=I,n=F;D=b.headers||{};I=b.services||{};F=b.autostart||F;b.lastModified?J=b.lastModified:(J=(new Date).getTime(),w());if(e(D,f)&&e(I,m)&&F===n)return(new g).resolve();if("active"===E||"starting"===E){var h=[];Object.keys(I).forEach(function(a){var c=I[a];h.push(a);var b=K[a];if(b){if(e(c.methods,Object.keys(b.proxy))){a=C(c);var f=b.registration.getReference(),d={};f.getPropertyKeys().forEach(function(a){d[a]=f.getProperty(a)});e(a,d)||b.registration.setProperties(a);return}b.registration.unregister();
delete K[a]}p(c)});Object.keys(K).forEach(function(a){-1===h.indexOf(a)&&(K[a].registration.unregister(),delete K[a])})}"active"===E&&(d.disconnect(O),H=new g,O=d.connect(a,z,Q),H.then(function(){H=null},function(){H=null;E="stopping";d.dispatchEvent(new c("stopping"),r);Object.keys(K).forEach(function(a){K[a].registration.unregister();delete K[a]});d.disconnect(O);O=null;E="resolved";d.dispatchEvent(new c("stopped",r))}));return(new g).resolve()};this.update=function(a){return P(a).then(function(){d.dispatchEvent(new c("updated",
r))})};this.uninstall=function(){if("uninstalled"===E)return(new g).reject(Error("Plugin is uninstalled"));if("active"===E||"starting"===E||"stopping"===E)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));d.removePlugin(this);E="uninstalled";d.dispatchEvent(new c("uninstalled",r));return(new g).resolve()}}var n=/^http[s]?/i;return{Plugin:a,PluginRegistry:function(b,f){function m(a){var c=a.source;z.some(function(b){if(c===b.target){try{var p;if("undefined"===typeof b.useStructuredClone){var f=
"string"!==typeof a.data;p=f?a.data:JSON.parse(a.data);b.useStructuredClone=f}else p=b.useStructuredClone?a.data:JSON.parse(a.data);b.handler(p)}catch(d){}return!0}})}f=f||{};var e=f.storage||localStorage;e.getItem||(e=h(e));var k="installed",v,x=[],z=[],A=new l,C={},p={registerService:b.registerService.bind(b),connect:function(a,c,b,p){function f(a){a=Error(a);a.name="timeout";c({method:"timeout",error:a})}var d={handler:c,url:a},m=setTimeout(f.bind(null,"Load timeout for: "+a),p||15E3),n=document.createElement("iframe");
n.name=a+"_"+(new Date).getTime();n.src=a;n.onload=function(){clearTimeout(m);m=setTimeout(f.bind(null,"Plugin handshake timeout for: "+a),5E3)};n.sandbox="allow-scripts allow-same-origin";n.style.width=n.style.height="100%";n.frameBorder=0;(b||v).appendChild(n);d.target=n.contentWindow;d.close=function(){clearTimeout(m);if(n){var a=n.parentNode;a&&a.removeChild(n);n=null}};z.push(d);return d},disconnect:function(a){for(var c=0;c<z.length;c++)if(a===z[c]){z.splice(c,1);try{a.close()}catch(b){}break}},
removePlugin:function(a){for(var c=0;c<x.length;c++)if(a===x[c]){x.splice(c,1);break}e.removeItem("plugin."+a.getLocation())},persist:function(a,c){e.setItem("plugin."+a,JSON.stringify(c))},postMessage:function(a,c){c.target.postMessage(c.useStructuredClone?a:JSON.stringify(a),c.url)},dispatchEvent:function(a){try{A.dispatchEvent(a)}catch(c){console&&console.log("PluginRegistry.dispatchEvent "+c)}},loadManifest:function(a){var c=new g,b=p.connect(a,function(a){b&&a.method&&("manifest"===a.method||
"plugin"===a.method?(a=a.params[0],p.disconnect(b),b=null,c.resolve(a)):"timeout"===a.method&&(p.disconnect(b),b=null,c.reject(a.error)))});return c.promise},getState:function(){return k},handleServiceError:function(a,c){if(c&&401===c.status){var b=a.getHeaders(),p=a.getName()||a.getLocation(),f=document.createElement("span");f.appendChild(document.createTextNode("Authentication required for: "+p+"."));b.login&&(f.appendChild(document.createTextNode(" ")),p=document.createElement("a"),p.target="_blank",
p.textContent="Login",p.href=b.login,n.test(p.href)?(f.appendChild(p),f.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+b.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(f)}}if(c.__isError){var d=c;c=Error(d.message);Object.keys(d).forEach(function(a){c[a]=d[a]});delete c.__isError}return c}};this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};
this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=p.getState;this.init=function(){if(!("starting"===k||"active"===k||"stopping"===k)){addEventListener("message",m,!1);for(var c=[],b=0,n=e.length;b<n;b++)c.push(e.key(b));c.forEach(function(c){if(0===c.indexOf("plugin.")){var b=c.substring(7);c=JSON.parse(e.getItem(c));c.created&&x.push(new a(b,c,p))}});x.sort(function(a,c){return a._getCreated()<c._getCreated()?-1:1});f.parent?v=f.parent:(v=document.createElement("div"),
f.visible||(v.style.display="none",v.style.visibility="hidden"),document.body.appendChild(v));f.plugins&&Object.keys(f.plugins).forEach(function(c){c=d(c);if(!this.getPlugin(c)){var b=f.plugins[c];"object"!==typeof b&&(b={});b.autostart=b.autostart||f.defaultAutostart||"lazy";x.push(new a(c,b,p))}}.bind(this));k="starting"}};this.start=function(){"starting"!==k&&this.init();if("starting"!==k)return(new g).reject("Cannot start framework. Framework is already "+k+".");var a=[],c=(new Date).getTime();
x.forEach(function(b){var p=b._getAutostart();0===b.getLastModified()?a.push(b.update().then(function(){if("started"===p)return b.start({"transient":!0});if("lazy"===p)return b.start({lazy:!0,"transient":!0});b._resolve()})):"started"===p?a.push(b.start({"transient":!0})):"lazy"===p?(a.push(b.start({lazy:!0,"transient":!0})),c>b.getLastModified()+864E5&&b.update()):b._resolve()});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){k="active"})};this.stop=function(){if("starting"!==
k&&"active"!==k)return(new g).reject("Cannot stop registry. Registry is already "+k+".");k="stopping";var a=[];x.forEach(function(c){a.push(c.stop({"transient":!0}))});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!f.parent){var a=v.parentNode;a&&a.removeChild(v)}v=null;removeEventListener("message",m);k="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new g).reject("Cannot uninstall registry")};
this.installPlugin=function(b,f){b=d(b);var m=this.getPlugin(b);if(m)return(new g).resolve(m);if(C[b])return C[b];if(f)return m=new a(b,f,p),x.push(m),m._persist(),p.dispatchEvent(new c("installed",m)),(new g).resolve(m);var n=p.loadManifest(b).then(function(f){m=new a(b,f,p);x.push(m);m._persist();delete C[b];p.dispatchEvent(new c("installed",m));return m},function(a){delete C[b];throw a;});return C[b]=n};this.getPlugins=function(){return x.slice()};this.getPlugin=function(a){var c=null;a=d(a);x.some(function(b){if(a===
b.getLocation())return c=b,!0});return c};this.addEventListener=A.addEventListener.bind(A);this.removeEventListener=A.removeEventListener.bind(A);this.resolvePlugins=function(){var a=!0;x.forEach(function(c){a=a&&c._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function g(e,d){function h(a){var b=a.getProperty("service.id"),d=this.addingService(a);d&&(f[b]=a,c[b]=d)}function b(a){var b=a.getProperty("service.id"),d=c[b];delete f[b];delete c[b];this.removedService(a,d)}this.serviceRegistry=e;var f={},c={},m=l,a,n;this.close=function(){if(m!==k)throw"Already closed";m=l;e.removeEventListener("registered",a);e.removeEventListener("unregistering",n);n=a=null;var c=this;this.getServiceReferences().forEach(function(a){b.call(c,
a)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var a=Object.keys(f);return!a.length?null:a.map(function(a){return f[a]})};this.open=function(){if(m!==l)throw"Already open";m=k;var c=this;a=function(a){if(-1!==a.serviceReference.getProperty("objectClass").indexOf(d)&&(h.call(c,a.serviceReference),"function"===typeof c.onServiceAdded))return c.onServiceAdded(a.serviceReference,c.serviceRegistry.getService(a.serviceReference))};n=function(a){-1!==a.serviceReference.getProperty("objectClass").indexOf(d)&&
b.call(c,a.serviceReference)};e.addEventListener("registered",a);e.addEventListener("unregistering",n);e.getServiceReferences(d).forEach(function(a){h.call(c,a);if("function"===typeof c.onServiceAdded)return c.onServiceAdded(a,e.getService(a))});if("function"===typeof this.onOpen)this.onOpen()}}var l=0,k=1;g.prototype={addingService:function(e){return this.serviceRegistry.getService(e)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(e,d){}};return g});
define("orion/objects",[],function(){function g(g){for(var k=1;k<arguments.length;k++){var e=arguments[k],d;for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&(g[d]=e[d])}return g}return{clone:function(l){if(Array.isArray(l))return Array.prototype.slice.call(l);var k=Object.create(Object.getPrototypeOf(l));g(k,l);return k},mixin:g,toArray:function(g){return Array.isArray(g)?g:[g]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(g,l,k){var e,d,h,b,f,c="pid";e=function(a,b,f){function d(a,c,f){c.forEach(function(d,m){try{var p=a[m].getProperty("__plugin__"),w=p&&b.getPlugin(p);(!p||w&&"active"===w.getState())&&c[m].updated(f)}catch(r){"undefined"!==typeof console&&console.log(r)}})}l.call(this,a,"orion.cm.managedservice");var m={},e={},h=function(b){var d=[];b.plugin.getServiceReferences().forEach(function(b){if(-1!==b.getProperty("objectClass").indexOf("orion.cm.managedservice")){var m=
b.getProperty(c);b=a.getService(b);m&&b&&(m=(m=f._find(m))&&m.getProperties(),d.push(b.updated(m)))}});return g.all(d)};this.addingService=function(b){var f=b.getProperty(c),d=a.getService(b);if(!f||!d)return null;m[f]||(m[f]=[]);e[f]||(e[f]=[]);m[f].push(b);e[f].push(d);return d};this.onServiceAdded=function(a,b){var m=a.getProperty(c),m=f._find(m);d([a],[b],m&&m.getProperties())};this.onOpen=function(){b.addEventListener("started",h)};this.onClose=function(){b.removeEventListener("started",h)};
this.notifyUpdated=function(a){var c=a.getPid();d(m[c]||[],e[c]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();d(m[a]||[],e[a]||[],null)};this.removedService=function(a,b){var f=a.getProperty(c),d=m[f],n=e[f];1<d.length?d.splice(d.indexOf(a),1):delete m[f];1<n.length?n.splice(n.indexOf(b),1):delete e[f]}};d=function(){function a(a,c,f){this.store=new h(this,f);this.configAdmin=new b(this,this.store);this.tracker=new e(a,c,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(c){a.tracker.open();return c})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();b=function(){function a(a,c){this.factory=a;this.store=c}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var m="/cm/configurations";
h=function(){function a(a,b){this.factory=a;this.prefsService=b;this.configs=Object.create(null);this.pref=null;var d=this;this.initPromise=this.prefsService.getPreferences(m).then(function(a){d.pref=a;a.keys().forEach(function(b){if(!d.configs[b]){var m=a.get(b);"object"===typeof m&&null!==m&&0<Object.keys(m).length&&(m[c]=b,d.configs[b]=new f(d.factory,d,m))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var c=this._find(a);
c||(c=new f(this.factory,this,a),this.configs[a]=c);return c},list:function(){var a=this,c=[];this.pref.keys().forEach(function(b){(b=a._find(b))&&null!==b.getProperties()&&c.push(b)});return c},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,c){this.pref.put(a,c.getProperties(!0)||{})}};return a}();f=function(){function a(a,b){b=k.clone(b);delete b[c];a.properties=b}function b(f,d,m){this.factory=f;this.store=d;if(null!==m&&"object"===typeof m)this.pid=m[c],a(this,
m);else if("string"===typeof m)this.pid=m,this.properties=null;else throw Error("Invalid pid/properties "+m);}b.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var b=null;this.properties&&(b=k.clone(this.properties),a||(b[c]=this.pid));return b},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(c){this._checkRemoved();a(this,c);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return b}();return{ConfigurationAdminFactory:d}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(g,l,k,e,d,h){var b;return{startup:function(){if(b)return b;b=new l;var f=new k.ServiceRegistry,c=new e.PreferencesService(f);return c.getPreferences("/plugins").then(function(m){var a={plugins:{}};m.keys().forEach(function(c){var b=g.toUrl(c);a.plugins[b]=m[c]});var n=new d.PluginRegistry(f,a);return n.start().then(function(){if(0<f.getServiceReferences("orion.core.preference.provider").length)return c.getPreferences("/plugins",
c.USER_SCOPE).then(function(a){var c=[];a.keys().forEach(function(a){a=g.toUrl(a);n.getPlugin(a)||c.push(n.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return l.all(c,function(a){console.log(a)})})}).then(function(){return(new h.ConfigurationAdminFactory(f,n,c)).getConfigurationAdmin().then(f.registerService.bind(f,"orion.cm.configadmin"))}).then(function(){var a=f.getService("orion.core.auth");if(a){var c=a.getUser().then(function(c){if(c)localStorage.setItem("lastLogin",
(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),b=localStorage.getItem("lastLogin");if(!b||b<(new Date).getTime()-9E5)return c}}).then(function(){var a={serviceRegistry:f,preferences:c,pluginRegistry:n};b.resolve(a);return a})})}}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Viewer":"Orion Markdown Viewer","Orion JSON Editor":"Orion JSON Editor",
"View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"2014-04-02_22-01-33","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Saved searches":"Saved searches","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* \x3d any string, ? \x3d any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/util",[],function(){var g=navigator.userAgent,l=-1!==g.indexOf("MSIE")||-1!==g.indexOf("Trident")?document.documentMode:void 0,k=parseFloat(g.split("Firefox/")[1]||g.split("Minefield/")[1])||void 0,e=-1!==g.indexOf("Opera")?parseFloat(g.split("Version/")[1]):void 0,d=parseFloat(g.split("Chrome/")[1])||void 0,h=-1!==g.indexOf("Safari")&&!d,b=parseFloat(g.split("WebKit/")[1])||void 0,f=-1!==g.indexOf("Android"),c=-1!==g.indexOf("iPad"),g=-1!==g.indexOf("iPhone"),m=c||g,a=-1!==navigator.platform.indexOf("Mac"),
n=-1!==navigator.platform.indexOf("Win"),q=-1!==navigator.platform.indexOf("Linux"),s="ontouchstart"in document.createElement("input");return{formatMessage:function(a){var c=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,b){return c[(b<<0)+1]})},createElement:function(a,c){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",c):a.createElement(c)},isIE:l,isFirefox:k,isOpera:e,isChrome:d,isSafari:h,isWebkit:b,isAndroid:f,isIPad:c,isIPhone:g,isIOS:m,isMac:a,isWindows:n,
isLinux:q,isTouch:s,platformDelimiter:n?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(g){function l(c,b){b||(b=document);return b.querySelectorAll(c)}function k(c){var b=c.tabIndex;0===b&&g.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[c.nodeName.toLowerCase()]&&!c.attributes.tabIndex&&(b=-1);return b}function e(c){if(0<=k(c))return c;if(c.hasChildNodes())for(var b=0;b<c.childNodes.length;b++){var a=e(c.childNodes[b]);if(a)return a}return null}function d(c){if(0<=
k(c))return c;if(c.hasChildNodes())for(var b=c.childNodes.length-1;0<=b;b--){var a=d(c.childNodes[b]);if(a)return a}return null}function h(c,f){if(3===c.nodeType){var a=b.exec(c.nodeValue);a&&1<a.length&&f(c,a)}if(c.hasChildNodes())for(a=0;a<c.childNodes.length;a++)h(c.childNodes[a],f)}var b=/\$\{([^\}]+)\}/,f=null;return{$:function(c,b){b||(b=document);return b.querySelector(c)},$$:l,$$array:function(c,b){return Array.prototype.slice.call(l(c,b))},node:function(c){var b=c;"string"===typeof c&&(b=
document.getElementById(c));return b},contains:function(c,b){if(!c||!b)return!1;if(c===b)return!0;var a=c.compareDocumentPosition(b);return Boolean(a&16)},bounds:function(c){c=c.getBoundingClientRect();return{left:c.left+document.documentElement.scrollLeft,top:c.top+document.documentElement.scrollTop,width:c.width,height:c.height}},empty:function(c){for(;c.hasChildNodes();)c.removeChild(c.firstChild)},firstTabbable:e,lastTabbable:d,stop:function(c){window.document.all&&(c.keyCode=0);c.preventDefault&&
(c.preventDefault(),c.stopPropagation())},processTextNodes:function(c,b){h(c,function(a,c){a.parentNode.replaceChild(document.createTextNode(b[c[1]]||c[1]),a)})},processDOMNodes:function(c,b){h(c,function(a,c){var f=b[c[1]];if(f){var d=document.createRange(),e=c.index;d.setStart(a,e);d.setEnd(a,e+c[0].length);d.deleteContents();d.insertNode(f)}})},addAutoDismiss:function(c,b){function a(a){f.forEach(function(c){var b=!1,f=c.excludeNodes.some(function(c){return document.body.contains(c)?(b=!0,c.contains(a.target)):
!1});if(b&&!f)try{c.dismiss(a)}catch(d){"undefined"!==typeof console&&console&&console.error(d&&d.message)}});f=f.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}null===f&&(f=[],document.addEventListener("click",a,!0),g.isIOS&&document.addEventListener("touchend",function(a){function c(){a.target.removeEventListener("click",c)}0===a.touches.length&&a.target.addEventListener("click",c)},!1));f.push({excludeNodes:c,dismiss:b})},setFramesEnabled:function(c){for(var b=
document.getElementsByTagName("iframe"),a=0;a<b.length;a++)b[a].parentNode.style.pointerEvents=c?"":"none"},removeAutoDismiss:function(c){f=f.filter(function(b){return c!==b.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
define("text",["module"],function(g){var l,k,e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],d=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,h=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,b="undefined"!==typeof location&&location.href,f=b&&location.protocol&&location.protocol.replace(/\:/,""),c=b&&location.hostname,m=b&&(location.port||void 0),a=[],n=g.config&&g.config()||{};l={version:"2.0.5",strip:function(a){if(a){a=a.replace(d,"");var c=a.match(h);c&&(a=c[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:n.createXhr||function(){var a,c,b;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(c=0;3>c;c+=1){b=e[c];try{a=new ActiveXObject(b)}catch(f){}if(a){e=[b];break}}return a},parseName:function(a){var c,
b,f=!1,d=a.indexOf(".");c=0===a.indexOf("./")||0===a.indexOf("../");-1!==d&&(!c||1<d)?(c=a.substring(0,d),b=a.substring(d+1,a.length)):c=a;a=b||c;d=a.indexOf("!");-1!==d&&(f="strip"===a.substring(d+1),a=a.substring(0,d),b?b=a:c=a);return{moduleName:c,ext:b,strip:f}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,c,b,f){var d,m;d=l.xdRegExp.exec(a);if(!d)return!0;a=d[2];d=d[3];d=d.split(":");m=d[1];d=d[0];return(!a||a===c)&&(!d||d.toLowerCase()===b.toLowerCase())&&(!m&&!d||m===f)},finishLoad:function(c,
b,f,d){f=b?l.strip(f):f;n.isBuild&&(a[c]=f);d(f)},load:function(a,d,e,h){if(h.isBuild&&!h.inlineText)e();else{n.isBuild=h.isBuild;var g=l.parseName(a);h=g.moduleName+(g.ext?"."+g.ext:"");var k=d.toUrl(h),x=n.useXhr||l.useXhr;!b||x(k,f,c,m)?l.get(k,function(c){l.finishLoad(a,g.strip,c,e)},function(a){e.error&&e.error(a)}):d([h],function(a){l.finishLoad(g.moduleName+"."+g.ext,g.strip,a,e)})}},write:function(c,b,f,d){a.hasOwnProperty(b)&&(d=l.jsEscape(a[b]),f.asModule(c+"!"+b,"define(function () { return '"+
d+"';});\n"))},writeFile:function(a,c,b,f,d){c=l.parseName(c);var m=c.ext?"."+c.ext:"",n=c.moduleName+m,e=b.toUrl(c.moduleName+m)+".js";l.load(n,b,function(c){c=function(a){return f(e,a)};c.asModule=function(a,c){return f.asModule(a,e,c)};l.write(a,n,c,d)},d)}};if("node"===n.env||!n.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)k=require.nodeRequire("fs"),l.get=function(a,c){var b=k.readFileSync(a,"utf8");0===b.indexOf("\ufeff")&&(b=b.substring(1));c(b)};else if("xhr"===
n.env||!n.env&&l.createXhr())l.get=function(a,c,b,f){var d=l.createXhr(),m;d.open("GET",a,!0);if(f)for(m in f)f.hasOwnProperty(m)&&d.setRequestHeader(m.toLowerCase(),f[m]);if(n.onXhr)n.onXhr(d,a);d.onreadystatechange=function(f){4===d.readyState&&(f=d.status,399<f&&600>f?(f=Error(a+" HTTP status: "+f),f.xhr=d,b(f)):c(d.responseText))};d.send(null)};else if("rhino"===n.env||!n.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)l.get=function(a,c){var b,f,d=new java.io.File(a),m=java.lang.System.getProperty("line.separator"),
d=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(d),"utf-8")),n="";try{b=new java.lang.StringBuffer;(f=d.readLine())&&f.length()&&65279===f.charAt(0)&&(f=f.substring(1));for(null!==f&&b.append(f);null!==(f=d.readLine());)b.append(m),b.append(f);n=String(b.toString())}finally{d.close()}c(n)};return l});define("text!orion/banner/slideout.html",[],function(){return'\x3cdiv id\x3d"slideContainer" class\x3d"slideParameters slideContainer"\x3e\n\t\x3cspan id\x3d"pageCommandParameters" class\x3d"layoutLeft parameters"\x3e\x3c/span\x3e\n\t\x3cspan id\x3d"pageCommandDismiss" class\x3d"layoutRight parametersDismiss"\x3e\x3c/span\x3e\n\x3c/div\x3e'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(g,l,k){return{slideoutHTMLFragment:function(e){var d=document.createElement("div");d.innerHTML=k;var h=l.$("#slideContainer",d);h.id=e+h.id;h=l.$("#pageCommandParameters",d);h.id=e+h.id;h=l.$("#pageCommandDismiss",d);h.id=e+h.id;return d.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(g){function l(e,d,h,b,f,c){this.type=c||"keydown";this.keyCode="string"===typeof e&&"keydown"===this.type?e.toUpperCase().charCodeAt(0):e;this.mod1=void 0!==d&&null!==d?d:!1;this.mod2=void 0!==h&&null!==h?h:!1;this.mod3=void 0!==b&&null!==b?b:!1;this.mod4=void 0!==f&&null!==f?f:!1}function k(e){this.keys=e}l.prototype={getKeys:function(){return[this]},match:function(e,d){if(void 0!==d){if(0!==d)return!1}else if(e instanceof Array){if(1<e.length)return!1;
e=e[0]}return e.type!==this.type?!1:this.keyCode===e.keyCode||this.keyCode===String.fromCharCode(g.isOpera?e.which:void 0!==e.charCode?e.charCode:e.keyCode)?this.mod1!==(g.isMac?e.metaKey:e.ctrlKey)||"keydown"===this.type&&this.mod2!==e.shiftKey||this.mod3!==e.altKey||g.isMac&&this.mod4!==e.ctrlKey?!1:!0:!1},equals:function(e){return!e||this.keyCode!==e.keyCode||this.mod1!==e.mod1||this.mod2!==e.mod2||this.mod3!==e.mod3||this.mod4!==e.mod4||this.type!==e.type?!1:!0}};k.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(e,d){var h=this.keys;if(void 0!==d)return d>h.length?!1:h[d].match(e)?d===h.length-1?!0:d+1:!1;e instanceof Array||(e=[e]);if(e.length>h.length)return!1;var b;for(b=0;b<e.length;b++)if(!h[b].match(e[b]))return!1;return b===h.length?!0:b},equals:function(e){if(!e.keys||e.keys.length!==this.keys.length)return!1;for(var d=0;d<e.keys.length;d++)if(!e.keys[d].equals(this.keys[d]))return!1;return!0}};return{KeyBinding:l,KeyStroke:l,KeySequence:k}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(g,l,k){function e(b){k.attach(this);this._init(b)}function d(b,f){var c=document.createElement(void 0===f?"span":f);c.tabIndex=0;c.className="dropdownMenuItem";c.role="menuitem";var d=document.createElement("span");d.appendChild(document.createTextNode(b));d.classList.add("dropdownCommandName");c.appendChild(d);d=document.createElement("li");d.appendChild(c);return d}function h(){var b=document.createElement("li");
b.classList.add("dropdownSeparator");return b}e.prototype={_init:function(b){this._dropdownNode=l.node(b.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=b.populate;this._selectionClass=b.selectionClass;this._parentDropdown=b.parentDropdown;this._positioningNode=b.positioningNode;if(!this._parentDropdown)for(var f=this._dropdownNode.parentNode;f&&document!==f;){if(f.classList&&f.classList.contains("dropdownMenu")){this._parentDropdown=f.dropdown;break}f=f.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=b.triggerNode?b.triggerNode:l.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!b.skipTriggerEventListeners){var c=this;this._triggerNode.addEventListener("click",function(b){c.toggle(b)&&l.stop(b)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(b){if(b.keyCode===l.KEY.ENTER||b.keyCode===l.KEY.SPACE)c.toggle(),l.stop(b)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(b){var f=this;b.addEventListener("click",function(c){f.toggle(c)&&l.stop(c)},!1)},toggle:function(b){return this.isVisible()?this.close():this.open(b)},isVisible:function(){return this._isVisible},open:function(b){var f=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:b}),l.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?l.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),f=l.$$array(".dropdownSubMenu",this._dropdownNode),l.addAutoDismiss([this._triggerNode].concat(f),this._boundAutoDismiss),this._hookedAutoDismiss=!0),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(b),this._dropdownNode.focus(),
f=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return f},_autoDismiss:function(b){if(this.close(!1)&&this._dropdownNode.contains(b.target))for(b=this._parentDropdown;b;)b.close(!1),b=b._parentDropdown},_positionDropdown:function(b){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{b=l.bounds(this._dropdownNode);var f=l.bounds(document.body);if(b.left+b.width>f.left+
f.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-b.width+"px";else{var c=l.bounds(this._boundingNode(this._triggerNode)),d=l.bounds(this._triggerNode);this._dropdownNode.style.left=d.left-c.left-b.width+d.width+"px"}b=b.top+b.height-(f.top+f.height);0<b&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-b)+"px")}},_boundingNode:function(b){var f=window.getComputedStyle(b,null);return null===f||"absolute"===f.getPropertyValue("position")||
!b.parentNode||b===document.body?b:this._boundingNode(b.parentNode)},close:function(b){var f=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),l.setFramesEnabled(!0),b&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=null),f=!0);return f},
getItems:function(){var b=[],f=this;l.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(c){c.parentNode.parentNode===f._dropdownNode&&b.push(c)});b.forEach(function(c){c._hasDropdownMouseover||(c.addEventListener("mouseover",function(b){c.dropdown?c.dropdown.open(b):(f._closeSelectedSubmenu(),l.stop(b));f._selectItem(c)}),c._hasDropdownMouseover=!0)});return b},empty:function(){var b=this;l.$$array("li",this._dropdownNode).forEach(function(f){f.parentNode===
b._dropdownNode&&f.parentNode.removeChild(f)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(b){if(b.keyCode===l.KEY.UP||b.keyCode===l.KEY.DOWN||b.keyCode===l.KEY.RIGHT||b.keyCode===l.KEY.ENTER||b.keyCode===l.KEY.LEFT){var f=this.getItems();if(f.length&&0<f.length){if(this._selectedItem){var c=f.indexOf(this._selectedItem);0>c&&(c=f.indexOf(this._selectedItem.parentNode));0<=c&&(b.keyCode===l.KEY.UP&&0<c?(c--,this._selectItem(f[c])):b.keyCode===l.KEY.DOWN&&c<f.length-1?(c++,this._selectItem(f[c])):
b.keyCode===l.KEY.ENTER||b.keyCode===l.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):b.keyCode===l.KEY.ENTER&&this._selectedItem.click():b.keyCode===l.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(f[0]);l.stop(b)}}else b.keyCode===
l.KEY.ESCAPE&&(this.close(!0),l.stop(b))},_selectItem:function(b){if(b=b||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=b,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(b){b!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=b)},_closeSelectedSubmenu:function(){for(var b=this._selectedSubmenu;b;)b.close(),
b=b._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&l.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(b,f){var c=d(b,f);this._dropdownNode.appendChild(c);return c},appendSeparator:function(){var b=h();this._dropdownNode.appendChild(b);return b}};e.prototype.constructor=e;return{Dropdown:e,appendKeyBindingString:function(b,f){var c=document.createElement("span");c.classList.add("dropdownKeyBinding");c.appendChild(document.createTextNode(f));b.appendChild(c)},
createMenuItem:d,createSeparator:h}});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger"\x3e${ButtonText}\x3c!--span class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span--\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger dropdownDefaultButton"\x3e${ButtonText}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});
define("text!orion/webui/submenutriggerbutton.html",[],function(){return'\x3cli class\x3d"dropdownSubMenu"\x3e\x3cspan class\x3d"dropdownTrigger dropdownMenuItem" role\x3d"menuitem" tabindex\x3d"0"\x3e\x3cspan class\x3d"dropdownCommandName"\x3e${ButtonText}\x3c/span\x3e\x3cspan class\x3d"dropdownArrowRight core-sprite-closedarrow"\x3e\x3c/span\x3e\x3c/span\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e\x3c/li\x3e'});define("text!orion/webui/checkedmenuitem.html",[],function(){return'\x3cli\x3e\x3clabel class\x3d"dropdownMenuItem"\x3e\x3cinput class\x3d"checkedMenuItem" role\x3d"menuitem" type\x3d"checkbox" /\x3e${ItemText}\x3c/label\x3e\x3c/li\x3e'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(g,l){function k(e){this._init(e)}k.prototype={_init:function(e){this._node=l.node(e.node);if(!this._node)throw"no dom node for tooltip found";this._position=e.position||["right","above","below","left"];this._text=e.text;this._hideDelay=void 0===e.hideDelay?200:e.hideDelay;this._tailSize=e.tailSize||10;this._trigger=e.trigger||"mouseover";this._afterShowing=e.afterShowing;this._afterHiding=e.afterHiding;var d=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(b){b.target===d._node&&(d.show(),l.stop(b))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===e.showDelay?500:e.showDelay;e=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(b){l.contains(d._node,b.target)&&(d.show(),l.stop(b))},!1);this._leaveHandler=function(b){l.contains(d._node,b.target)&&d.hide()};for(var h=0;h<e.length;h++)this._node.addEventListener(e[h],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text){this._tipTextContent=document.createElement("div");this._tipTextContent.classList.add("textContent");this._tipInner.appendChild(this._tipTextContent);var e=document.createTextNode(this._text);this._tipTextContent.appendChild(e)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var d=this;l.addAutoDismiss([this._tip,this._node],function(){d.hide()});"mouseover"===this._trigger&&(this._tipInner.role="tooltip",this._tipInner.id="tooltip"+(new Date).getTime().toString(),this._node.setAttribute("aria-describedby",this._tipInner.id),this._tip.addEventListener("mouseover",function(e){d._timeout&&(window.clearTimeout(d._timeout),d._timeout=null);d._tip.addEventListener("mouseout",function(b){l.contains(d._tip,b.target)&&(d.hide(),l.stop(b))},
!1)},!1))}return this._tip},_positionTip:function(e,d){this._makeTipNode();"left"===e?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var h=this._node,b;for(b=l.bounds(h);h&&!b.width&&!b.height;h=h.parentNode)b=l.bounds(h);var h=l.bounds(this._tipInner),f;switch(e){case "above":f=b.top-h.height-this._tailSize-1;b=b.left-this._tailSize;break;case "below":f=b.top+b.height+this._tailSize+1;b=b.left-this._tailSize;break;case "left":f=b.top-this._tailSize/2;b=b.left-h.width-
this._tailSize-1;break;default:f=b.top-this._tailSize/2,b=b.left+b.width+this._tailSize+1}var c=l.bounds(document.documentElement);if(f+h.height>c.height)if(d)f=c.height-h.height-1;else return!1;if(b+h.width>c.width)if(d)b=c.width-h.width-1;else return!1;if(0>b)if(d)b=4;else return!1;if(0>f)if(d)f=4;else return!1;this._tail&&this._tail.previousPosition!==e&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
e),"above"===e||"left"===e?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),"left"===e&&(this._tail.style.left=h.width+"px"),this._tail.previousPosition=e);this._tip.style.top=f+"px";this._tip.style.left=b+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing"))this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=
window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately()},_showImmediately:function(){for(var e=!1,d=0;!e&&d<this._position.length;)e=this._positionTip(this._position[d]),d++;e||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(e){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===e&&(e=
this._hideDelay);var d=this;this._timeout=window.setTimeout(function(){d._tip.classList.remove("tooltipShowing");d._tip.removeAttribute("style");d._afterHiding&&d._afterHiding()},e)}},destroy:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);this._tip&&(document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null);if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",
this._mouseoverHandler,!1);for(var e=["mouseout","click"],d=0;d<e.length;d++)this._node.removeEventListener(e[d],this._leaveHandler,!1)}}};k.prototype.constructor=k;return{Tooltip:k}});
define("orion/commands","orion/util orion/webui/littlelib orion/webui/dropdown text!orion/webui/dropdowntriggerbutton.html text!orion/webui/dropdowntriggerbuttonwitharrow.html text!orion/webui/submenutriggerbutton.html text!orion/webui/checkedmenuitem.html orion/webui/tooltip".split(" "),function(g,l,k,e,d,h,b,f){function c(a){var c=a.invocation;if(c){var b=a.command;if(b.hrefCallback)return a=b.hrefCallback.call(c.handler||window,c),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;if(c.commandRegistry)return c.commandRegistry._invoke(c),
!0;if(b.onClick||b.callback)return window.setTimeout(function(){(b.onClick||b.callback).call(c.handler||window,c)},0),!0}return!1}function m(a,b){for(var f in b)if(b[f]&&b[f].keyBinding&&b[f].command&&b[f].keyBinding.match(a)){var p=b[f],d=p.keyBinding;if((!d.domScope||l.contains(l.node(d.domScope),a.target))&&c(p)){l.stop(a);break}}}function a(){var a={};if(v){var c,b,p;b=Object.keys(x);for(c=0;c<b.length;c++)p=b[c],a[p]=x[p];var f=v();b=Object.keys(f);for(c=0;c<b.length;c++)p=b[c],a[p]=f[p]}else a=
x;return a}function n(c){m(c,a())}function q(a,c){a=a||window.event;if(function(a){if(g.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return 0<a["char"].length;if(a.charCode||a.keyCode)switch(a=a.charCode||
a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return 32<=a&&112>a||123<a}return!1}(a)){if("true"===a.target.contentEditable)return;var b=a.target.nodeName.toLowerCase();if("input"===b)switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if("textarea"===b)return}c?c(a):n(a)}function s(){this._init()}
function t(a,c,b){c.classList.add("commandImage");var p;a.imageClass?a.addImageClassToElement?c.classList.add(a.imageClass):(p=document.createElement("span"),c.appendChild(p),p.classList.add(a.spriteClass),p.classList.add(a.imageClass)):(p=new Image,p.alt=a.name,p.name=b,p.id=b,p.src=a.image,c.appendChild(p));return p}function y(a,c,b,p,f){this.commandRegistry=f;this.handler=a;this.items=c;this.userData=b;this.command=p;p.parameters&&(this.parameters=p.parameters.makeCopy());this.id=p.id}function u(a){this._init(a)}
var v=null,x={};s.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(c){return q(c,function(c){var b=a.proxy,f=a.bindings;if(f&&b)for(var d=0;d<f.length;d++)f[d].match(c)&&(b.processKey({type:c.type,keyCode:c.keyCode,altKey:c.altKey,ctrlKey:c.ctrlKey,metaKey:c.metaKey,shiftKey:c.shiftKey}),l.stop(c))})})}};window.document.addEventListener("keydown",q,!1);y.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(a){var c=new y(this.handler,this.items,this.userData,this.command,this.commandRegistry);c.domNode=this.domNode;c.domParent=this.domParent;a?c.parameters=a.makeCopy():this.parameters&&(c.parameters=this.parameters.makeCopy());return c}};y.prototype.constructor=y;u.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;
this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,c,b,p,
f){b=this.getChoices(c,b,p);var d=b.some(function(a){return a.checked});b.forEach(function(b){if(b.name){var p=document.createElement("li");a.appendChild(p);var m=document.createElement("span");m.tabIndex=0;m.role="menuitem";m.classList.add("dropdownMenuItem");if(d){var n=document.createElement("span");n.classList.add("check");n.appendChild(document.createTextNode(b.checked?"\u25cf":""));m.appendChild(n)}n=document.createTextNode(b.name);m.appendChild(n);p.appendChild(m);m.choice=b;m.addEventListener("click",
function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,c)},!1);m.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,c)},!1)}else f._generateMenuSeparator(a)})},getChoices:function(a,c,b){return this.choiceCallback?this.choiceCallback.call(c,a,b):null},makeChoiceCallback:function(a,c){return function(b){a.callback&&a.callback.call(a,c,b)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};u.prototype.constructor=u;return{Command:u,CommandInvocation:y,createDropdownMenu:function(a,c,b,p,f,m,n,h,q){a=l.node(a);if(!a)throw"no parent node was specified";var g=document.createRange();g.selectNode(a);g=q?g.createContextualFragment(d):g.createContextualFragment(e);l.processTextNodes(g,{ButtonText:c});a.appendChild(g);a=a.lastChild;
var s;q?(q=a.previousSibling,s=q.lastChild):q=a.previousSibling;p?q.classList.add(p):(q.classList.add("orionButton"),q.classList.add("commandButton"));f&&(m||(q.textContent="",q.setAttribute("aria-label",c)),t({spriteClass:"commandSprite",imageClass:f},q,c),q.classList.add("orionButton"));q.dropdown=new k.Dropdown({dropdown:a,populate:b,selectionClass:n,skipTriggerEventListeners:!!s,positioningNode:h});a.dropdown=q.dropdown;return{menuButton:q,menu:a,dropdown:q.dropdown,dropdownArrow:s}},createCheckedMenuItem:function(a,
c,f,p){a=l.node(a);if(!a)throw"no parent node was specified";var d=document.createRange();d.selectNode(a);d=d.createContextualFragment(b);l.processTextNodes(d,{ItemText:c});a.appendChild(d);a=l.$(".checkedMenuItem",a.lastChild);a.checked=f;a.addEventListener("change",p,!1);return a},createCommandItem:function(a,c,b,p,d,m,n){var e;m=m||!c.name&&c.hasImage();if(c.hrefCallback)e=document.createElement("a"),e.id=p,m&&c.hasImage()?t(c,e,p):(e.className="commandLink",e.appendChild(document.createTextNode(c.name))),
n=c.hrefCallback.call(b.handler,b),n.then?n.then(function(a){e.href=a}):e.href=n?n:"#";else{e=document.createElement("button");e.className="orionButton";m?c.hasImage()?(t(c,e,p),c.name&&e.setAttribute("aria-label",c.name)):(e.classList.add("commandButton"),e.classList.add("commandMissingImageButton"),e.appendChild(document.createTextNode(c.name))):(e.classList.add("commandButton"),p=document.createTextNode(c.name),e.appendChild(p));var h=n||c.callback;h&&(c.onClick=h,e.addEventListener("click",function(a){h.call(b.handler,
b)},!1))}"ul"===a.nodeName.toLowerCase()?(n=document.createElement("li"),a.appendChild(n),a=n):e.classList.add("commandMargins");a.appendChild(e);c.tooltip&&(e.commandTooltip=new f.Tooltip({node:e,text:c.tooltip,position:["above","below","right","left"]}));d&&(x[c.id]={keyBinding:d,command:c,invocation:b});return e},createCommandMenuItem:function(a,c,b,p,d,m){var n,e,h=a.dropdown;if(c.hrefCallback)e=k.createMenuItem(c.name,"a"),n=e.firstElementChild,d=c.hrefCallback.call(b.handler,b),d.then?d.then(function(a){n.href=
a}):n.href=d?d:"#",n.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&n.click()},!1);else{e=k.createMenuItem(c.name);n=e.firstElementChild;var q=d||c.callback;q&&(c.onClick=q,n.addEventListener("click",function(a){h.close(!0);q.call(b.handler,b)},!1),n.addEventListener("keydown",function(a){if(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)a.preventDefault(),n.click()},!1))}c.tooltip&&(n.commandTooltip=new f.Tooltip({node:n,text:c.tooltip,position:["above",
"below","right","left"]}));m&&k.appendKeyBindingString(n,m);a.appendChild(e);p&&(x[c.id]={keyBinding:p,command:c,invocation:b});return n},executeBinding:c,setKeyBindingProvider:function(a){v=a},localKeyBindings:x,CommandsProxy:s,getKeyBindings:a,processKey:n,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:m}});
define("orion/explorers/navigationUtils",[],function(){function g(g,e,d,h){!l&&g&&(g.push({domNode:e}),e.tabIndex=-1,e.style.outline="none")}var l=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(k,e,d){k&&(k=k.getGridNavHolder(e,!0))&&g(k,d)},generateNavGrid:g,removeNavGrid:function(g,e){if(g)for(var d=0;d<g.length;d++)if(g[d].domNode===e){g.splice(d,1);break}}}});
define("orion/PageUtil",[],function(){var g=/^http[s]?/i;return{hash:function(){var g=window.location.href.split("#")[1];return g?"#"+g:""},matchResourceParameters:function(g){g=g||window.location.toString();var k={resource:""},e=g.indexOf("#");if(-1!==e&&(g=g.substring(e+1),0!==g.length)){g=g.split(",");k.resource=decodeURIComponent(g[0]);for(e=1;e<g.length;e++){var d=/([^=]*)(=?)(.*)/.exec(g[e]),h=decodeURIComponent(d[1]||""),d=decodeURIComponent(d[3]||"");""!==h&&"resource"!==h&&(k[h]=d)}}return k},
validateURLScheme:function(l,k){var e=l;if(-1===l.indexOf("://")){var d=document.createElement("a");d.href=l;e=d.href}d=!1;if(d=k?k.some(function(d){return RegExp("^"+d+":","i").test(e)}):g.test(e))return l;console.log("Illegal URL Scheme: '"+l+"'");return""}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(g){function l(e){var d="",h=-1!==navigator.platform.indexOf("Mac");h?(e.mod4&&(d+="\u2303"),e.mod3&&(d+="\u2325"),e.mod2&&(d+="\u21e7"),e.mod1&&(d+="\u2318")):(e.mod1&&(d+="Ctrl+"),e.mod2&&(d+="Shift+"),e.mod3&&(d+="Alt+"));if(e.alphaKey)return d+e.alphaKey;if("keypress"===e.type)return d+e.keyCode;for(var b in g.KEY)if(typeof("number"===g.KEY[b])&&g.KEY[b]===e.keyCode){if(h)switch(g.KEY[b]){case g.KEY.BKSPC:b="\u232b";break;case g.KEY.TAB:b=
"\u21e5";break;case g.KEY.ENTER:b="\u23ce";break;case g.KEY.ESCAPE:b="\u238b";break;case g.KEY.SPACE:b="\u2423";break;case g.KEY.PAGEUP:b="\u21de";break;case g.KEY.PAGEDOWN:b="\u21df";break;case g.KEY.END:b="\u21f2";break;case g.KEY.HOME:b="\u21f1";break;case g.KEY.DEL:b="\u2326"}switch(g.KEY[b]){case g.KEY.DOWN:b="\u2193";break;case g.KEY.UP:b="\u2191";break;case g.KEY.RIGHT:b="\u2192";break;case g.KEY.LEFT:b="\u2190"}return d+b}var f;switch(e.keyCode){case 59:f=e.mod2?":":";";break;case 61:f=e.mod2?
"+":"\x3d";break;case 188:f=e.mod2?"\x3c":",";break;case 190:f=e.mod2?"\x3e":".";break;case 191:f=e.mod2?"?":"/";break;case 192:f=e.mod2?"~":"`";break;case 219:f=e.mod2?"{":"[";break;case 220:f=e.mod2?"|":"\\";break;case 221:f=e.mod2?"}":"]";break;case 222:f=e.mod2?'"':"'"}return f?d+f:112<=e.keyCode&&123>=e.keyCode?d+"F"+(e.keyCode-111):d+String.fromCharCode(e.keyCode)}function k(e){var d=-1!==window.navigator.platform.indexOf("Mac");return d&&e.metaKey||!d&&e.ctrlKey}return{getUserKeyString:function(e){var d=
"";e=e.getKeys();for(var h=0;h<e.length;h++)0!==h&&(d+=" "),d+=l(e[h]);return d},getUserText:function(e){var d=e.id,h=e.refNode,b=e.hideRefNode,f=e.initialText,c=e.onComplete,m=e.onEditDestroy,a=e.selectTo,n=e.isInitialValid;e=e.insertAsChild;var q=!1,s=function(a){return function(e){if(!q){var s=g.node(d),k=s.value;s&&(a&&e.keyCode===g.KEY.ESCAPE?(b&&(h.style.display="inline"),q=!0,s.parentNode.removeChild(s),m&&m()):a&&e.keyCode!==g.KEY.ENTER||(0===k.length||!n&&k===f?b&&(h.style.display="inline"):
(c(k),b&&h.parentNode&&(h.style.display="inline")),q=!0,s.parentNode&&s.parentNode.removeChild(s),m&&m()))}}},k=document.createElement("input");k.id=d;k.value=f||"";e?h.appendChild(k):h.parentNode.insertBefore(k,h.nextSibling);k.classList.add("userEditBoxPrompt");b&&(h.style.display="none");k.addEventListener("keydown",s(!0),!1);k.addEventListener("blur",s(!1),!1);window.setTimeout(function(){k.focus();if(f){var c=g.node(d),b=a?f.indexOf(a):-1;0<b?c.createTextRange?(c=c.createTextRange(),c.collapse(!0),
c.moveStart("character",0),c.moveEnd("character",b),c.select()):c.setSelectionRange?c.setSelectionRange(0,b):void 0!==c.selectionStart&&(c.selectionStart=0,c.selectionEnd=b):c.select()}},0)},openInNewWindow:k,followLink:function(e,d){d&&k(d)?window.open(e):window.location=e},createButton:function(e,d){var h=document.createElement("button");h.className="orionButton commandButton commandMargins";h.addEventListener("click",function(b){d();g.stop(b)},!1);e&&h.appendChild(document.createTextNode(e));return h},
createDropdownButton:function(e,d,h){},isFormElement:function(e){switch(e.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/commandRegistry","orion/commands orion/explorers/navigationUtils orion/PageUtil orion/uiUtils orion/webui/littlelib orion/webui/dropdown orion/webui/tooltip text!orion/webui/checkedmenuitem.html text!orion/webui/dropdowntriggerbutton.html text!orion/webui/submenutriggerbutton.html".split(" "),function(g,l,k,e,d,h,b,f,c,m){function a(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function n(a,c){this.token=a;this.parameterName=c}function q(a,c,b){this.event=a;this.handler=c;this.capture=b||!1}function s(a,c,b,f,d,m){this.name=a;this.type=c;this.label=b;this.value=f;this.lines=d||1;this.eventListeners=Array.isArray(m)?m:m?[m]:[]}function t(a,c,b){this._storeParameters(a);this._hasOptionalParameters=c&&c.hasOptionalParameters;this._options=c;this.optionsRequested=!1;this.getParameters=b;this.clientCollect=c&&c.clientCollect}a.prototype={_init:function(a){this._selectionService=
a.selection;var c=this;g.setKeyBindingProvider(function(){return c._activeBindings})},processURL:function(a){for(var c in this._urlBindings)if(this._urlBindings[c]&&this._urlBindings[c].urlBinding&&this._urlBindings[c].command){var b=this._urlBindings[c].urlBinding.match(a);if(b){var f=this._urlBindings[c],d=f.command,m=f.invocation;if(m&&m.parameters&&d.callback){m.parameters.setValue(b.parameterName,b.parameterValue);var n=this;window.setTimeout(function(){n._invoke(m)},0);break}}}},findCommand:function(a){return this._commandList[a]},
runCommand:function(a,c,b,f){c?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(c):1)&&a.callback&&this._invoke(new g.CommandInvocation(b,c,null,a,this),f):(c=this._urlBindings[a])&&c.command&&c.command.callback&&this._invoke(c.invocation,f)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,c,b){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,
c,b))},confirm:function(a,c,b,f,d,m){var n=!1;if(this._parameterCollector&&!d){var p=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,d){var m=document.createElement("span");m.classList.add("parameterPrompt");m.textContent=c;a.appendChild(m);m=document.createElement("button");m.addEventListener("click",function(a){n=!0;p._parameterCollector.close()},!1);d.appendChild(m);m.appendChild(document.createTextNode(b));m.className="dismissButton";var e=document.createElement("button");
e.addEventListener("click",function(a){n=!1;p._parameterCollector.close()},!1);d.appendChild(e);e.appendChild(document.createTextNode(f));e.className="dismissButton";return m},function(){m(n)}))return}n=window.confirm(c);m(n)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(a,c){return this._collectAndInvoke(a.makeCopy(c),!1)},_collectAndInvoke:function(a,c){if(a)if(this._parameterCollector&&
a.parameters&&a.parameters.hasParameters()&&(c||a.parameters.shouldCollectParameters())){var f=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(f=this._parameterCollector.collectParameters(a),!f)){var d=new b.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),f=d.contentContainer();f.classList.add("parameterPopup");var m=window.document.activeElement,n=this._parameterCollector.getFillFunction(a,
function(){m&&m.focus();d.destroy()})(f);d.show();window.setTimeout(function(){n.focus();n.select()},0);f=!0}f||a.command.callback.call(a.handler||window,a)}else a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(a){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){function c(a){return function(){g.executeBinding(a)}}var b={},f,d,m=[],n;for(n in this._activeBindings)(d=
this._activeBindings[n])&&d.keyBinding&&d.command&&(d.command.name||d.command.tooltip)&&m.push(d);m.sort(function(a,c){return(a.command.name||a.command.tooltip).localeCompare(c.command.name||c.command.tooltip)});for(n=0;n<m.length;n++)d=m[n],d.keyBinding.scopeName?(b[d.keyBinding.scopeName]||(b[d.keyBinding.scopeName]=[]),b[d.keyBinding.scopeName].push(d)):(f=e.getUserKeyString(d.keyBinding),a.createItem(f,d.command.name||d.command.tooltip,c(d)));for(var p in b)b[p].length&&0<b[p].length&&(a.createHeader(p),
b[p].forEach(function(b){f=e.getUserKeyString(b.keyBinding);a.createItem(f,b.command.name||b.command.tooltip,c(b))}))},addCommand:function(a){this._commandList[a.id]=a;var c=this._pendingBindings[a.id];if(c){var b=this;c.forEach(function(c){b._addBinding(a,c.type,c.binding,c.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,c,b,f,d,m,n,p,e,r){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];d&&(a=this._createEntryForPath(a,
d));a[c]?(f&&(a[c].title=f),b&&(a[c].position=b),n&&(a[c].imageClass=n),p&&(a[c].tooltip=p),e&&(a[c].selectionClass=e),!0===r?a[c].pretendDefaultActionId=!0:a[c].defaultActionId=r,a[c].emptyGroupMessage=m):(a[c]={title:f,position:b,emptyGroupMessage:m,imageClass:n,tooltip:p,selectionClass:e,defaultActionId:!0===r?null:r,pretendDefaultActionId:!0===r,children:{}},a.sortedContributions=null)},_createEntryForPath:function(a,c){c&&c.split("/").forEach(function(c){1<c.length&&(a[c]||(a[c]={position:0,
children:{}},a.sortedContributions=null),a=a[c].children)});return a},registerSelectionService:function(a,c){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=c},registerCommandContribution:function(a,c,b,f,d,m,n){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];f&&(a=this._createEntryForPath(a,f));a[c]={position:b};m&&((b=this._commandList[c])?this._addBinding(b,"key",
m,d):this._addPendingBinding(c,"key",m,d));n&&((b=this._commandList[c])?this._addBinding(b,"url",n,d):this._addPendingBinding(c,"url",n,d));a.sortedContributions=null},unregisterCommandContribution:function(a,c,b){if(this._contributionsByScopeId[a]){delete this._commandList[c];delete this._activeBindings[c];delete this._urlBindings[c];delete this._pendingBindings[c];var f=this._contributionsByScopeId[a];b&&b.split("/").forEach(function(a){1<a.length&&f[a]&&(f=f[a].children)});delete f[c];f.sortedContributions=
null}},_addBinding:function(a,c,b,f){if(!a.id)throw Error("No command id: "+a);"key"===c?this._activeBindings[a.id]={command:a,keyBinding:b,bindingOnly:f}:"url"===c&&(this._urlBindings[a.id]={command:a,urlBinding:b,bindingOnly:f})},_addPendingBinding:function(a,c,b,f){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:c,binding:b,bindingOnly:f})},_checkForTrailingSeparator:function(a,c,b){var f;if("tool"===c||"button"===c)if((f=0<a.childNodes.length?a.childNodes[a.childNodes.length-
1]:null)&&f.classList.contains("commandSeparator"))return b?(a.removeChild(f),!1):!0;if("menu"===c&&(a=d.$$array("li \x3e *",a),0<a.length&&a[a.length-1].classList.contains("dropdownSeparator")))if(f=a[a.length-1],b)f.parentNode.parentNode.removeChild(f.parentNode);else return!0;return!1},renderCommands:function(a,c,b,f,m,n,e){if("string"!==typeof a)throw"a scope id for rendering must be specified";c=d.node(c);if(!c)throw"no parent";var p=this._contributionsByScopeId[a];if(!b&&p){b=p.localSelectionService||
this._selectionService;var w=this;b&&b.getSelections(function(b){w.renderCommands(a,c,b,f,m,n)})}else p&&(this._render(p,c,b,f,m||"button",n,e),this._checkForTrailingSeparator(c,m,!0))},destroy:function(a){a=d.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var c=a.firstChild;c.commandTooltip&&c.commandTooltip.destroy();c.emptyGroupTooltip&&c.emptyGroupTooltip.destroy();this.destroy(c);a.removeChild(c)}},_render:function(a,c,f,d,m,n,h){var p=a.sortedContributions;if(!p){var p=[],w=!1,r;for(r in a)if(Object.prototype.hasOwnProperty.call(a,
r)){var q=a[r];q&&"number"===typeof q.position&&(q.id=r,p.push(q),w=!0)}w&&(p.sort(function(a,c){return a.position-c.position}),a.sortedContributions=p)}var s=0,k=this;p.forEach(function(a){var p;a.imageClass||(a.imageClass=null);if(a.children&&0<Object.getOwnPropertyNames(a.children).length){var r=a.children;if("tool"===m||"button"===m)if(a.title){var w;a.defaultActionId&&((r=k._commandList[a.defaultActionId])&&(r.visibleWhen?r.visibleWhen(f):1)?(w=new g.CommandInvocation(d,f,n,r,k),w.domParent=
c):a.pretendDefaultActionId=!0);r=k._createDropdownMenu(c,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,w,a.pretendDefaultActionId);h&&l.generateNavGrid(h,r.menuButton);r&&(k._render(a.children,r.menu,f,d,"menu",n,h),k._checkForTrailingSeparator(r.menu,"menu",!0),0===r.menu.childNodes.length?a.emptyGroupMessage?r.menuButton.emptyGroupTooltip||(r.menuButton.emptyGroupTooltip=new b.Tooltip({node:r.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above",
"left"]})):(h&&l.removeNavGrid(h,r.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(r.menu),a(r.menuButton),a(r.destroyButton)):r.menuButton.style.visibility="visible")}else{var q;0<c.childNodes.length&&!k._checkForTrailingSeparator(c,m)&&(q=k.generateSeparatorImage(c));k._render(r,c,f,d,m,n,h);0<c.childNodes.length&&c.childNodes[c.childNodes.length-1]!==q&&(q=k.generateSeparatorImage(c))}else if(a.title){if(a=k._createDropdownMenu(c,a.title,!0,null,null,a.imageClass))k._render(r,
a.menu,f,d,"menu",n,h),k._checkForTrailingSeparator(a.menu,"menu",!0),0===a.menu.childNodes.length&&a.destroyButton&&c.removeChild(a.destroyButton)}else 0<c.childNodes.length&&k._generateMenuSeparator(c),k._render(r,c,f,d,m,n,h),k._generateMenuSeparator(c)}else{var B=k._commandList[a.id],r=B?!0:!1;w=a=null;if(B){p=new g.CommandInvocation(d,f,n,B,k);p.domParent=c;q=!1;try{q=r&&(B.visibleWhen?B.visibleWhen(f):!0)}catch(t){throw console.log(t),t;}k._activeBindings[B.id]&&k._activeBindings[B.id].keyBinding&&
(a=k._activeBindings[B.id],a.invocation=q?p:null,a.bindingOnly&&(r=!1));k._urlBindings[B.id]&&k._urlBindings[B.id].urlBinding&&(w=k._urlBindings[B.id],w.invocation=q?p:null,w.bindingOnly&&(r=!1));r=r&&q}r&&(B.choiceCallback?("tool"===m||"button"===m?(a=c,r=!1,"ul"===c.nodeName.toLowerCase()&&(a=document.createElement("li"),c.appendChild(a))):(a=c,r=!0),k._createDropdownMenu(a,B.name,r,function(a){B.populateChoicesMenu(a,f,d,n,k)}.bind(B),B.imageClass,B.tooltip||B.title,B.selectionClass,B.positioningNode)):
(p.handler=p.handler||this,p.domParent=c,r=function(a){k._invoke(p)},"menu"===m?(w=null,a&&a.keyBinding&&(w=e.getUserKeyString(a.keyBinding)),a=g.createCommandMenuItem(c,B,p,null,r,w)):(a=m+B.id+s,a=g.createCommandItem(c,B,p,a,null,"tool"===m,r)),l.generateNavGrid(h,a),p.domNode=a,s++))}})},_createDropdownMenu:function(a,c,f,n,e,q,s,p,w,r){a=d.node(a);if(!a||!d.contains(document.body,a))return null;var B,k,t=a;if(f)q=document.createRange(),q.selectNode(a),q=q.createContextualFragment(m),d.processTextNodes(q,
{ButtonText:c}),a.appendChild(q),k=a.lastChild,e=k.lastChild,c=e.previousSibling,c.dropdown=new h.Dropdown({dropdown:e,populate:n,parentDropdown:a.dropdown}),e.dropdown=c.dropdown;else{"ul"===a.nodeName.toLowerCase()&&(t=document.createElement("li"),a.appendChild(t),k=t);a=null;e&&(a="dropdownButtonWithIcon",q=q||c);q=e?q||c:q;var l=g.createDropdownMenu(t,c,n,a,e,!1,s,p,w||r);B=l.dropdownArrow;c=l.menuButton;if(B){w&&(w.domNode=l.menuButton);var J=this;c.onclick=function(a){var c=d.bounds(B);a.clientX>=
c.left&&l.dropdown?l.dropdown.toggle(a):J._invoke(w)};l.dropdown&&(c.onkeydown=function(a){d.KEY.DOWN===a.keyCode&&(l.dropdown.toggle(a),d.stop(a))})}e=l.menu;var E;(n=w&&w.command&&(w.command.tooltip||w.command.name))?E=w.command.tooltip||w.command.name:n&&(E=q);E&&(c.commandTooltip=new b.Tooltip({node:c,text:E,position:["above","below","right","left"]}))}return{menuButton:c,menu:e,dropdown:c.dropdown,destroyButton:k,dropdownArrow:B}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,
"menu")){var c=document.createElement("li");c.classList.add("dropdownSeparator");var b=document.createElement("span");b.classList.add("dropdownSeparator");c.appendChild(b);a.appendChild(c)}},generateSeparatorImage:function(a){var c;c="ul"===a.nodeName.toLowerCase()?document.createElement("li"):document.createElement("span");a.appendChild(c);c.classList.add("core-sprite-sep");c.classList.add("imageSprite");c.classList.add("commandSeparator");return c}};a.prototype.constructor=a;n.prototype={match:function(a){a=
k.matchResourceParameters(a);return"undefined"!==typeof a[this.token]?(this.parameterValue=a[this.token],this):null}};n.prototype.constructor=n;q.prototype.constructor=q;s.prototype={optionsRequested:function(){return this.optionsRequested}};s.prototype.constructor=s;t.prototype={_storeParameters:function(a){this.parameterTable=null;if(a){var c=this.parameterTable={};a.forEach(function(a){c[a.name]=a})}},updateParameters:function(a){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(a))},
hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,c){var b=this.parameterTable[a];b&&(b.value=c)},forEach:function(a){for(var c in this.parameterTable)this.parameterTable[c].type&&this.parameterTable[c].name&&a(this.parameterTable[c])},makeCopy:function(){var a=
[];this.forEach(function(c){c=new s(c.name,c.type,c.label,c.value,c.lines,c.eventListeners);a.push(c)});var c=new t(a,this._options,this.getParameters);c.clientCollect=this.clientCollect;return c},hasOptionalParameters:function(){return this._hasOptionalParameters}};t.prototype.constructor=t;return{CommandRegistry:a,URLBinding:n,ParametersDescription:t,CommandParameter:s,CommandEventListener:q}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(g,l,k){function e(d,e){this._activeContainer=null;this._getElementsFunction=d;this._toolbarLayoutFunction=e}e.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&k.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&k.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();this._oldFocusNode&&(this._oldFocusNode.focus(),this._oldFocusNode=null)}this._activeElements=null},open:function(d,e,b){"string"===typeof d&&(d=k.node(d));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===d)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(d))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=b;var f=e(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!f)return!1;this._activeElements.focusNode=f;d=k.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===d.length){e=this._activeElements.dismissArea||
this._activeElements.parameterArea;d=document.createElement("button");d.id="closebox";d.className="imageSprite core-sprite-close dismissButton";d.title=g.Close;e.appendChild(d);var c=this;d.addEventListener("click",function(b){c.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);f&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){f.focus();f.select&&f.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(d,e){k.$$array("input",e).forEach(function(b){"checkbox"===b.type?d.parameters.setValue(b.parameterName,b.checked):"button"!==b.type&&d.parameters.setValue(b.parameterName,b.value.trim())});k.$$array("textArea",e).forEach(function(b){d.parameters.setValue(b.parameterName,b.value.trim())});d.command.callback&&d.command.callback.call(d.handler,d)},collectParameters:function(d){return d.parameters?
(d.domNode&&d.domNode.classList.add("commandMarker"),this.open(d.domNode||d.domParent,this.getFillFunction(d))):!1},getFillFunction:function(d,e){var b=this;return function(f,c){var m=null,a=function(){e&&e();b.close()},n=function(c){c.keyCode===k.KEY.ENTER&&b._collectAndCall(d,f);if(c.keyCode===k.KEY.ESCAPE||c.keyCode===k.KEY.ENTER)a(),k.stop(c)};d.parameters.forEach(function(c){var b=null;c.label&&(b=document.createElement("label"),b.classList.add("parameterInput"),b.setAttribute("for",c.name+"parameterCollector"),
b.textContent=c.label,f.appendChild(b));var e=c.name+"parameterCollector",h,b=b||f;"text"===c.type&&"number"===typeof c.lines&&1<c.lines?(h=document.createElement("textarea"),h.rows=c.lines,h.type="textarea",h.id=e,b.appendChild(h),n=function(c){c.keyCode===k.KEY.ESCAPE&&(a(),k.stop(c))}):"boolean"===c.type?(h=document.createElement("input"),h.type="checkbox",h.id=e,b.appendChild(h),c.value&&(h.checked=!0)):(h=document.createElement("input"),h.type=c.type,h.id=e,b.appendChild(h),c.value&&(h.value=
c.value));h.classList.add("parameterInput");h.setAttribute("speech","speech");h.setAttribute("x-webkit-speech","x-webkit-speech");h.parameterName=c.name;m||(m=h);0<c.eventListeners.length&&c.eventListeners.forEach(function(a){h.addEventListener(a.event,function(c){return a.handler(c,d)},a.capture)});h.addEventListener("keydown",n,!1)});var q=c;q||(q=document.createElement("span"),q.classList.add("layoutRight"),q.classList.add("parametersDismiss"),f.appendChild(q));var s=function(a,c){var b=document.createElement("button");
c.appendChild(b);a&&b.appendChild(document.createTextNode(a));b.classList.add("dismissButton");return b};d.parameters.hasOptionalParameters()&&(d.parameters.optionsRequested=!1,s(g.More,q).addEventListener("click",function(){d.parameters.optionsRequested=!0;b._collectAndCall(d,f);a()},!1));s(g.Submit,q).addEventListener("click",function(){b._collectAndCall(d,f);a()},!1);q=s(null,q);q.id="closebox";q.classList.add("imageSprite");q.classList.add("core-sprite-close");q.title=g.Close;q.addEventListener("click",
function(c){a()},!1);return m}}};e.prototype.constructor=e;return{CommandParameterCollector:e}});define("orion/regex",[],function(){return{escape:function(g){return g.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26")},parse:function(g){return(g=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(g))?{pattern:g[1],flags:g[2]}:null}}});
define("orion/contentTypes",[],function(){function g(c,a){if("string"!==typeof c)return null;for(var b=c&&c.split(".").pop(),f=null,d=0;d<a.length;d++){var e=a[d],h;h=f;var g=e,k=b,l=0<=g.filename.indexOf(c),z;z=k.toLowerCase();z=-1!==g.extension.indexOf(z);if(l||z){if(!(z=!h))l&&(k=k.toLowerCase(),l=-1!==h.extension.indexOf(k)),z=l;z&&(h=g)}h===e&&(f=e)}return f}function l(c){return null===c||"undefined"===typeof c?[]:Array.isArray(c)?c:[c]}function k(c){return l(c).map(function(a){return String.prototype.toLowerCase.call(a)})}
function e(c){return{id:c.id,name:c.name,image:c.image,imageClass:c.imageClass,"extends":c["extends"],extension:k(c.extension),filename:l(c.filename)}}function d(c){var a=Object.create(null);c.map(e).forEach(function(c){Object.prototype.hasOwnProperty.call(a,c.id)||(a[c.id]=c)});return a}function h(m){if(m&&m.registerService){this.serviceRegistry=m;for(var a=m.getServiceReferences(f).concat(m.getServiceReferences(c)),n=[],e=0;e<a.length;e++)for(var h=l(a[e].getProperty("contentTypes")),g=0;g<h.length;g++)n.push(h[g]);
this.map=d(n);m.registerService(b,this)}else if(Array.isArray(m))this.serviceRegistry=null,this.map=d(m);else throw Error("Invalid parameter");}var b="orion.core.contentTypeRegistry",f="orion.core.contenttype",c="orion.file.contenttype";h.prototype={getContentTypes:function(){var c=this.getContentTypesMap(),a=[],b;for(b in c)Object.prototype.hasOwnProperty.call(c,b)&&a.push(c[b]);return a},getContentTypesMap:function(){return this.map},getFileContentType:function(c){return g(c.Name,this.getContentTypes())},
getFilenameContentType:function(c){return g(c,this.getContentTypes())},getContentType:function(c){return this.map[c]||null},isExtensionOf:function(c,a){c="string"===typeof c?this.getContentType(c):c;a="string"===typeof a?this.getContentType(a):a;if(!c||!a)return!1;if(c.id===a.id)return!0;for(var b=c,f={};b&&(b=this.getContentType(b["extends"]));){if(b.id===a.id)return!0;if(f[b.id])throw Error("Cycle: "+b.id);f[b.id]=!0}return!1},isSomeExtensionOf:function(c,a){for(var b=0;b<a.length;b++)if(this.isExtensionOf(c,
a[b]))return!0;return!1}};return{ContentTypeRegistry:h,getFilenameContentType:g}});
define("orion/URITemplate",[],function(){function g(a){this._text=a}function l(a){return a.replace("%25","%")}function k(a,c){if("U"===c)return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===c)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(m,l);if("U+R-,"===c)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+c);}function e(a,c,b){for(var f=
[],d=0;d<a.length;d++)"undefined"!==typeof a[d]&&f.push(k(a[d],c));return f.join(b)}function d(a,c,b,f){for(var d=Object.keys(a),m=[],e=0;e<d.length;e++)"undefined"!==typeof a[d[e]]&&m.push(k(d[e],c)+b+k(a[d[e]],c));return m.join(f)}function h(a){if(0===a.length)throw Error("Invalid Expression: 0 length expression");(this._operator=f[a[0]])?a=a.substring(1):this._operator=f.NUL;for(var b=[],d=a.split(","),m=0;m<d.length;m++){var e=d[m].match(c);if(null===e)throw Error("Bad VarSpec: "+a);b.push({name:e[1],
explode:!!e[2],prefix:e[3]?parseInt(e[3],10):-1})}this._varSpecList=b}function b(a){for(var c=[],b=0,f=a.indexOf("{",b);-1!==f;){c.push(new g(a.substring(b,f)));b=a.indexOf("}",f+1);if(-1===b)throw Error("Invalid template: "+a);c.push(new h(a.substring(f+1,b)));b+=1;f=a.indexOf("{",b)}c.push(new g(a.substring(b)));this._templateComponents=c}var f={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"\x26":{first:"\x26",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},c=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,m=/%25[0-9A-F][0-9A-F]/g;g.prototype={expand:function(a){return encodeURI(this._text)}};
h.prototype={expand:function(a){for(var c=[],b=0;b<this._varSpecList.length;b++){var f=this._varSpecList[b],m=f.name,h=a[m],g=typeof h;if("undefined"!==g&&null!==h){var l=0===c.length?this._operator.first:this._operator.sep;if("string"===g)this._operator.named&&(l+=k(m,"U+R"),l+=0===h.length?this._operator.ifemp:"\x3d"),-1!==f.prefix&&f.prefix<h.length&&(h=h.substring(0,f.prefix)),l+=k(h,this._operator.allow);else if(Array.isArray(h)){if(0===h.length)continue;f.explode?l+=e(h,this._operator.allow,
this._operator.sep):(f=e(h,this._operator.allow,","),this._operator.named&&(l+=k(m,"U+R"),l+=0===f.length?this._operator.ifemp:"\x3d"),l+=f)}else if("object"===g){if(0===Object.keys(h).length)continue;f.explode?l+=d(h,this._operator.allow,"\x3d",this._operator.sep):(f=d(h,this._operator.allow,",",","),this._operator.named&&(l+=k(m,"U+R"),l+=0===f.length?this._operator.ifemp:"\x3d"),l+=f)}else throw Error("bad param type: "+m+" : "+g);c.push(l)}}return c.join("")}};b.prototype={expand:function(a){for(var c=
[],b=0;b<this._templateComponents.length;b++)c.push(this._templateComponents[b].expand(a));return c.join("")}};return b});
define("orion/i18nUtil",["require","orion/Deferred"],function(g,l){function k(d){if(d=localStorage.getItem("orion/messageBundle/"+d))if(d=JSON.parse(d),d._expires&&d._expires>(new Date).getTime())return delete d._expires,d;return null}var e={};return{getMessageBundle:function(d){function h(a){a?g(["i18n!"+d],function(a){if(a){var c=d;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+c,JSON.stringify(a));delete a._expires}f.resolve(a)}):b(Error(d))}function b(a){f.reject(a)}
if(e[d])return e[d];var f=new l;e[d]=f;var c=k(d);if(c)return f.resolve(c),f;try{g([d],h,b)}catch(m){g(["orion/i18n!"+d],h,b)}return f},formatMessage:function(d){var e=arguments;return d.replace(/\$\{([^\}]+)\}/g,function(b,f){return e[(f<<0)+1]})}}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(g,l,k,e,d,h,b){function f(){return g.toUrl?(new URL(g.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function c(a){var c={};a.getPropertyKeys().forEach(function(b){"objectClass"!==b&&"service.names"!==b&&"service.id"!==b&&"__plugin__"!==b&&(c[b]=a.getProperty(b))});return c}function m(a){return d.getMessageBundle(a.nls).then(function(c){a.textContent=
a.nameKey?c[a.nameKey]:a.name;return a},function(c){a.textContent=a.nameKey||a.name;return a})}function a(a,b){var d=a.getServiceReferences(b||"orion.page.link"),n=k.matchResourceParameters(window.location.href),h={OrionHome:f(),Location:n.resource},q=[];d.forEach(function(a){a=c(a);if(a.uriTemplate&&(a.nls||a.name)){var b=(new e(a.uriTemplate)).expand(h),b=k.validateURLScheme(b);a.href=b;a.nls?q.push(m(a)):(a.textContent=a.name,q.push((new l).resolve(a)))}});return l.all(q)}function n(a){var c=this.categories=
Object.create(null);a.forEach(function(a){c[a.id]=a})}function q(a){this.allPageLinks=a;this.allPageLinks.sort(s)}function s(a,c){var b=a.textContent&&a.textContent.toLowerCase(),f=c.textContent&&c.textContent.toLowerCase();return b<f?-1:b>f?1:0}var t;h.mixin(n.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});h.mixin(q.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var c=a.href;a=
a.textContent;var b=document.createElement("a");b.href=c;b.target="_self";b.classList.add("targetSelector");b.textContent=a;return b})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(a){var b;return!t?(b=[],a.getServiceReferences("orion.page.link.category").forEach(function(a){a=c(a);if(a.id&&(a.name||a.nameKey))a.nls?b.push(m(a)):(a.textContent=a.name,b.push((new l).resolve(a)))}),l.all(b).then(function(a){return t=new n(a)})):(new l).resolve(t)},getPageLinksInfo:function(c,
b){return a(c,b).then(function(a){return new q(a)})},getOrionHome:f}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/extensionCommands","require orion/Deferred orion/commands orion/regex orion/contentTypes orion/URITemplate orion/i18nUtil orion/URL-shim orion/PageLinks i18n!orion/edit/nls/messages".split(" "),function(g,l,k,e,d,h,b,f,c,m){function a(a){var c={};a.getPropertyKeys().forEach(function(b){c[b]=a.getProperty(b)});return c}var n={},q=c.getOrionHome();n._cloneItemWithoutChildren=function u(a){if(null===a||"object"!==typeof a)return a;var c=a.constructor(),b;for(b in a)"children"!==b&&"Children"!==
b&&(c[b]=u(a[b]));return c};n._getOpenWithNavCommandExtensions=function(a,c){function b(a,c){for(var f=a.getServiceReferences("orion.navigate.openWith"),d=[],p=[],m=0;m<f.length;m++){var n=f[m];if(n.getProperty("editor")===c.id){var e=n.getProperty("contentType");e instanceof Array?d=d.concat(e):d.push(e||"*/*");n=n.getProperty("excludedContentTypes");n instanceof Array?p=p.concat(n):null!==n&&"undefined"!==typeof n&&p.push(n)}}0===d.length&&(d=null);0===p.length&&(p=null);return{contentTypes:d,excludedContentTypes:p}}
for(var f=function(){for(var c=a.getServiceReferences("orion.edit.editor"),b=[],f=0;f<c.length;f++){var d=c[f],p=d.getProperty("id");b.push({id:p,"default":d.getProperty("default")||!1,name:d.getProperty("name"),nameKey:d.getProperty("nameKey"),nls:d.getProperty("nls"),uriTemplate:d.getProperty("orionTemplate")||d.getProperty("uriTemplate"),validationProperties:d.getProperty("validationProperties")||[]})}return b}(),d=[],m=0;m<f.length;m++){var p=f[m],n=b(a,p);d.push({properties:{name:p.name||p.id,
nameKey:p.nameKey,id:"eclipse.openWithCommand."+p.id,contentType:n.contentTypes,excludedContentTypes:n.excludedContentTypes,uriTemplate:p.uriTemplate,nls:p.nls,forceSingleItem:!0,isEditor:p["default"]?"default":"editor",validationProperties:p.validationProperties},service:{}})}return d};n._makeValidator=function(a,c,b,f){function m(a,c,b,f,d){var p=!1,n;if("!"===c.charAt(0))return"undefined"===typeof a[c.substring(1)];if("undefined"!==typeof a[c]){if("undefined"===typeof b)n=a[c],p=!0;else if("string"===
typeof b){if(!typeof("string"===a[c]))return!1;if(f.variableName){if(b=RegExp(b).exec(a[c]))p=b[0],n="before"===f.variableMatchPosition?a[c].substring(0,b.index):"after"===f.variableMatchPosition?a[c].substring(b.index+p.length):"only"===f.variableMatchPosition?p:a[c],p=!0}else return RegExp(b).test(a[c])}else a[c]===b&&(n=a[c],p=!0);c=f.variableName;f=f.replacements;if(p&&c&&(d[c]=n,d.itemCached=a,f)){if("string"!==typeof n)return window.console.log("Cannot replace "+c+", value is not a string: "+
n),p;for(a=0;a<f.length;a++){n=!1;if(f[a].pattern){b=f[a].pattern;var e=f[a].replacement||"";d[c]=d[c].replace(RegExp(b),e).replace(RegExp(b),e)}else n=!0;n&&window.console.log("Invalid replacements specified in validation property.  "+f[a])}}return p}return!1}function n(a,c,b,f){var d=b.match,p,e;if(0<=(p=c.indexOf("["))){if(0>(e=c.indexOf("]")))return!1;var h=c.substring(0,p),q;if(!(q=a[h])||!Array.isArray(q))return!1;p=c.substring(p+1,e);p=parseInt(p,10);if(isNaN(p))return!1;0>p&&(p+=q.length);
c=c.substring(e+1);c=h+":"+String(p)+c}return 0<=c.indexOf("|")?(p=c.substring(0,c.indexOf("|")),c=c.substring(c.indexOf("|")+1),n(a,p,b,f)?!0:n(a,c,b,f)):0<=c.indexOf(":")?(p=c.substring(0,c.indexOf(":")),c=c.substring(c.indexOf(":")+1),a[p]?n(a[p],c,b,f):!1):m(a,c,d,b,f)}function p(c,b,f){if(f.info.validationProperties)for(var p=0;p<f.info.validationProperties.length;p++){var m=f.info.validationProperties[p];if("undefined"!==typeof m.source){if(!n(c,m.source,m,f))return!1}else return window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified."),!1}var p=!0,e=b?d.getFilenameContentType(c.Name,b):null,e=e||{id:"application/octet-stream"};f.info.excludedContentTypes&&b&&(p=f.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==e.id.search(a)?!1:!0}));p&&f.info.contentType&&b&&(p=f.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==e.id.search(a)?!0:!1}));return p}return{info:a,validationFunction:function(a){"function"===typeof f&&(a=f.call(this,a));
if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==a.length||1>a.length)return!1}else a=[a];for(var c=0;c<a.length;c++)if(!p(a[c],b,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var c={},b;for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&(c[b]=a[b]);if(this.info.validationProperties)for(b=0;b<this.info.validationProperties.length;b++){var f=this.info.validationProperties[b];
f.source&&f.variableName&&(this.itemCached===a&&this[f.variableName]||n(a,f.source,f,this),a[f.variableName]?window.console.log("Variable name "+f.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):c[f.variableName]=this[f.variableName])}c.OrionHome=q;return(new h(this.info.uriTemplate)).expand(c)}return null}}};var s=m.UnnamedCommand;n._createCommandOptions=function(a,c,f,d,m,e){function p(b,p){var r=n._makeValidator(a,f,d,e);b.visibleWhen=
r.validationFunction.bind(r);if(m)if(r.generatesURI.bind(r)())b.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return r.getURI.bind(r)(a)};else{var w=a;b.callback=function(a){var p;if(w.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,p=n._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){p=[];for(var d=0;d<a.items.length;d++)p.push(n._cloneItemWithoutChildren(a.items[d]))}else p=n._cloneItemWithoutChildren(a.items);if(f)var m=f.getService("orion.page.progress");
c.run?m?m.progress(c.run(p),"Running command: "+b.name):c.run(p):f&&(m?m.progress(f.getService(c).run(p),"Running command: "+b.name):f.getService(c).run(p))}}p.resolve(b)}var w=new l;if(a.nls){var r=function(c){var b;c?(b=a.tooltipKey&&c[a.tooltipKey],c=a.nameKey&&c[a.nameKey]||a.name||s,b=b||a.tooltip||""):(c=a.name||a.nameKey||s,b=a.tooltip||a.tooltipKey||"");p({name:c,image:a.image,id:a.id||a.name,tooltip:b,isEditor:a.isEditor,showGlobally:a.showGlobally},w)};b.getMessageBundle(a.nls).then(r,r.bind(this,
null))}else p({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},w);return w};n.getOpenWithCommand=function(a,c,b){var f;a=b||n.getOpenWithCommands(a);for(b=0;b<a.length;b++)if(a[b].visibleWhen(c)){var d="default"===a[b].isEditor;if(!f||d)if(f=a[b],d)break}return f};n.getOpenWithCommands=function(a){var c=[],b;for(b in a._commandList){var f=a._commandList[b];f.isEditor&&c.push(f)}return c};var t;n.createAndPlaceFileCommandsExtension=function(a,
c,b,f,d,e){return n.createFileCommands(a,null,e?"all":void 0,!!e,c).then(function(a){d&&0<a.length&&(c.addCommandGroup(b,"eclipse.openWith",1E3,m.OpenWith,d,null,null,null,"dropdownSelection"),c.addCommandGroup(b,"eclipse.fileCommandExtensions",1E3,m.OpenRelated,d));a.forEach(function(a){var p=null;d&&(p=a.isEditor?d+"/eclipse.openWith":d+"/eclipse.fileCommandExtensions");c.registerCommandContribution(b,a.id,f,p)});return{}})};n.createFileCommands=function(a,c,b,f,d){b=void 0===b?"global":b;f=void 0===
f?!0:f;var m=[];n._cachedFileCommands||n._createCachedFileCommands(a);("all"===b||"global"===b)&&n._cachedFileCommands.forEach(function(a){var c=a.properties;("all"===b||c.forceSingleItem&&c.showGlobally)&&m.push(a)});return l.when(function(){var b=a.getService("orion.core.contentTypeRegistry")||c;return t||l.when(b.getContentTypes(),function(a){return t=a})}(),function(){f&&(n._cachedOpenWithExtensions||(n._cachedOpenWithExtensions=n._getOpenWithNavCommandExtensions(a,t)),m=m.concat(n._cachedOpenWithExtensions),
d._addedOpenWithCommands=f);var c=m.map(function(c){var b=c.properties;c=c.service;var f=d.findCommand(b.id||b.name);return f?(new l).resolve(f):n._createCommandOptions(b,c,a,t,!0).then(function(a){a=new k.Command(a);d.addCommand(a);return a})});return l.all(c,function(a){return{_error:a}}).then(function(a){return a})})};n._createCachedFileCommands=function(c){var b=c.getServiceReferences("orion.navigate.command");n._cachedFileCommands=[];for(var f=0;f<b.length;f++)if("orion.navigateFromMetadata"!==
b[f].getProperty("id")){var d=c.getService(b[f]),m=a(b[f]);n._cachedFileCommands.push({properties:m,service:d})}};n.getFileCommandIds=function(){var a=[];if(n._cachedFileCommands)n._cachedFileCommands.length&&(a=n._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};n.createOpenWithCommands=function(a,c,b){return b&&b._addedOpenWithCommands?(new l).resolve(n.getOpenWithCommands(b)):n.createFileCommands(a,c,
"none",!0,b)};return n});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(g,l){function k(e){this._init(e)}k.prototype={_init:function(e){var d=l.node(e.container);if(!d)throw"no parent container";this._container=d;d.classList.remove("currentLocation");this._id=e.id||"eclipse.breadcrumbs";this._resource=e.resource||null;this._rootSegmentName=e.rootSegmentName;this._workspaceRootSegmentName=e.workspaceRootSegmentName;this._workspaceRootURL=e.workspaceRootURL;this._makeHref=e.makeHref;this._makeFinalHref=
e.makeFinalHref;this._maxLength=e.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var e;if(this._resource&&this._resource.Parents&&!this._resource.skip){e=document.createElement("a");var d=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(e,d):e.href=g.toUrl("edit/edit.html")+"#"+d}else e=document.createElement("span");l.empty(e);e.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return e}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(e){var d=document.createElement("a");d.classList.add("breadcrumb");d.appendChild(document.createTextNode(e));return d},addSegmentHref:function(e,d){this._makeHref?this._makeHref(e,d.Location,d):e.href=g.toUrl("edit/edit.html")+"#"+d.ChildrenLocation},buildSegments:function(e,d){if(this._resource.Parents){var h=this._resource.Parents.slice(0),b,f;h&&(h=h.slice(0),"reverse"===d&&(h=h.reverse().slice(0)),
h.forEach(function(c){c.skip||(e?(f=e,e=null):f=c.Name,b=this.buildSegment(f),this.path+=c.Name,this.addSegmentHref(b,c),b.include=!1,this.segments.push(b))}.bind(this)))}},addDivider:function(){var e=document.createElement("span");e.appendChild(document.createTextNode(" / "));this.path+="/";e.classList.add("breadcrumbSeparator");this.append(e)},refresh:function(){(this.crumbs=l.node(this._id))?l.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(e){this.crumbs.appendChild(e)},addTitle:function(e,d){var h=d||document.title;0===this.crumbs.childNodes.length&&(e=document.createElement("span"),e.appendChild(document.createTextNode(h)),
e.classList.add("breadcrumb"),e.classList.add("currentLocation"),this.append(e))},finalSegment:function(e,d){if(!this._resource.skip){var h;h=d?d:this._resource.Name;this._makeFinalHref?(e=this.buildSegment(h),this.addSegmentHref(e,this._resource)):(e=document.createElement("span"),e.appendChild(document.createTextNode(h)));e.classList.add("currentLocation");this.path+=this._resource.Name;this.append(e)}},firstSegment:function(e){e&&(this.append(e),this._resource&&this._resource.Parents&&!this._resource.skip?
(e.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(e.href=""),e.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(e){!0===e.include&&(this.append(e),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var e=this.segments.slice(0).reverse();e.forEach(function(d){this.append(d);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?d.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=e.reverse()}},measure:function(){var e=this._container;e.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:e.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var e=this.getNavigatorWorkspaceRootSegment(),d=this._rootSegmentName;d?this.addTitle(e,d):(this.finalSegment(e,d),this._resource&&this._resource.Parents&&(this.buildSegments(d,"reverse"),this.measureSegments(),this.firstSegment(e)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var e=this.getNavigatorWorkspaceRootSegment(),d=this._rootSegmentName;d?this.addTitle(e,d):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(e),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(e,d)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};k.prototype.constructor=k;return{BreadCrumbs:k}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(g,l,k){function e(d){l.attach(this);this._init(d)}e.prototype={_init:function(d){this._tracking=null;this._animationDelay=501;this._closeReversely=d.closeReversely;this.$node=k.node(d.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=k.node(d.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=k.node(d.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=d.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");d.toggle&&(this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout"));this._closeByDefault="closed"===this.$node.getAttribute("data-initial-state");"undefined"!==typeof d.closeByDefault&&(this._closeByDefault=d.closeByDefault);this._initializeFromStoredSettings();
this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display="block";this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1);window.addEventListener("mouseup",this._mouseUp.bind(this),!1);window.addEventListener("resize",this._resize.bind(this),!1)},isClosed:function(){return this._closed},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||
this._thumbDown()},addResizeListener:function(d){this.addEventListener("resize",function(e){d(e.node)})},_initializeFromStoredSettings:function(){var d=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof d?"closed"===d:this._closeByDefault;var d=k.bounds(this.$node.parentNode),e=k.bounds(this.$node),b;this._vertical?(b=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(b,10),this._splitTop>d.top+d.height-e.height&&(this._splitTop=d.top+d.height/
2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(b=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(b,10),this._splitLeft>d.left+d.width-e.width&&(this._splitLeft=d.left+d.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var d=k.bounds(this.$node),e=k.bounds(this.$node.parentNode);return this.vertical?d.top-e.top:d.left-e.left},_adjustToSplitPosition:function(d){var e=
k.bounds(this.$node),b=k.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=e.height;if(d||!this._splitTop)this._splitTop=e.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);d=this._splitTop;"relative"===this.$node.parentNode.style.position&&(d=this._splitTop-b.top);this.$sideNode.style.height=d+"px";this.$sideNode.style.display="block";this.$node.style.top=d+"px"}else{this._splitWidth=e.width;if(d||!this._splitLeft)this._splitLeft=e.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);d=this._splitLeft;"relative"===this.$node.parentNode.style.position&&(d=this._splitLeft-b.left);this.$sideNode.style.width=d+"px";this.$sideNode.style.display="block";this.$node.style.left=d+"px"}this._resize()},_resize:function(d,e,b){d=d||0;var f=k.bounds(this.$node.parentNode),c=k.bounds(this.$node);this._vertical?(void 0===b&&(b=c.top-f.top),b+=c.height,this.$mainNode.style.top=b+"px"):(void 0===e&&(e=c.left-f.left),e+=c.width,this.$mainNode.style.left=e+"px");var m=
this;window.setTimeout(function(){m._notifyResizeListeners(m.$mainNode);m._notifyResizeListeners(m.$sideNode)},d)},_notifyResizeListeners:function(d){this.dispatchEvent({type:"resize",node:d})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(d,e){d||this._addAnimation();var b=this._splitTop,f=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&!this._splitTop&&"number"===typeof this._initialSplit&&(b=f=this._initialSplit);
else if(this._closed=!0,this._closeReversely){var c=k.bounds(this.$node.parentNode),m=k.bounds(this.$node);this._vertical?b=c.height-m.height:f=c.width-m.width}else b=f=0;this._vertical?(this.$sideNode.style.height=b+"px",this.$node.style.top=b+"px"):(this.$sideNode.style.width=f+"px",this.$node.style.left=f+"px");this._resize(this._animationDelay,f,b);d||this._removeAnimation();e||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var a=this;window.setTimeout(function(){a._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var d=this;window.setTimeout(function(){d.$sideNode.classList.remove(d._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");d.$mainNode.classList.remove(d._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");d.$node.classList.remove(d._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":
"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_mouseDown:function(d){if(d.target===this._thumb)return k.stop(d),this._thumbDown();this._tracking||(this.$node.classList.add("splitTracking"),this.$mainNode.classList.add("panelTracking"),this.$sideNode.classList.add("panelTracking"),this._tracking=this._mouseMove.bind(this),
window.addEventListener("mousemove",this._tracking),k.setFramesEnabled(!1),k.stop(d))},_mouseMove:function(d){if(this._tracking){var e=k.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=d.clientY;this._splitTop<e.top+5?this._splitTop=e.top+5:this._splitTop>e.top+e.height-5&&(this._splitTop=e.top+e.height-5);var b=this._splitTop,b=this._splitTop-e.top;this.$node.style.top=b+"px"}else this._splitLeft=d.clientX,this._splitLeft<e.left+5?this._splitLeft=e.left+5:this._splitLeft>e.left+e.width-
5&&(this._splitLeft=e.left+e.width-5),b=this._splitLeft-2*e.left,this.$node.style.left=b+"px";this._adjustToSplitPosition(!0);k.stop(d)}},_mouseUp:function(d){this._tracking&&(k.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),k.stop(d))}};e.prototype.constructor=e;return{Splitter:e}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(g,l,k){function e(d){this.commandRegistry=d.commandRegistry;this.create();this._filterString="";this._providers=[]}e.prototype={addProvider:function(d){this._providers.push(d)},create:function(){var d=this._keyAssistDiv=document.createElement("div");d.id="keyAssist";d.style.display="none";d.classList.add("keyAssistFloat");d.setAttribute("role","menu");var e=this._keyAssistInput=document.createElement("input");
e.classList.add("keyAssistInput");e.type="text";e.placeholder=g["Filter bindings"];d.appendChild(e);var b=this._keyAssistContents=document.createElement("div");b.classList.add("keyAssistContents");if(k.isIOS||k.isAndroid)b.style.overflowY="auto";d.appendChild(b);var f=this._keyAssistTable=document.createElement("table");f.tabIndex=0;f.classList.add("keyAssistList");b.appendChild(f);document.body.appendChild(d);e.addEventListener("keydown",function(c){this._keyDown(c)}.bind(this));f.addEventListener("keydown",
function(c){this._keyDown(c)}.bind(this));e.addEventListener("input",function(c){this.filterChanged()}.bind(this));b.addEventListener(k.isFirefox?"DOMMouseScroll":"mousewheel",function(c){this._scrollWheel(c)}.bind(this));document.addEventListener("keydown",function(c){c.keyCode===l.KEY.ESCAPE&&this.hide()}.bind(this));l.addAutoDismiss([d],function(){this.hide()}.bind(this))},createContents:function(){l.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var d=this._idCount=
this._keyAssistContents.scrollTop=0;d<this._providers.length;d++)this._providers[d].showKeyBindings(this);this.createHeader(g.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(d,e,b){if(this._filterString){var f=this._filterString.toLowerCase(),c;f!==this._filterString?(f=this._filterString,c=function(a){return a}):c=function(a){return a.toLowerCase()};if(-1===c(e).indexOf(f)&&-1===c(d).indexOf(f)&&-1===c(this._lastHeader).indexOf(f))return}var m=this._keyAssistTable.insertRow(-1);
m.id="keyAssist-keyBinding-"+this._idCount++;m.setAttribute("role","menuitem");m._execute=b;m.classList.add("keyAssistItem");m.addEventListener("click",function(a){this._selectedRow=m;this.execute();a.preventDefault()}.bind(this));b=m.insertCell(-1);b.classList.add("keyAssistName");b.appendChild(document.createTextNode(e));b=m.insertCell(-1);b.classList.add("keyAssistAccel");b.appendChild(document.createTextNode(d))},createHeader:function(d){this._lastHeader=d;var e=this._keyAssistTable.insertRow(-1);
e.classList.add("keyAssistSection");var e=e.insertCell(-1),b=document.createElement("h2");b.appendChild(document.createTextNode(d));e.appendChild(b)},execute:function(){window.setTimeout(function(){this.hide();var d=this._selectedRow;this._selectedRow=null;d&&d._execute&&d._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var d=this._keyAssistInput.value;this._filterString!==d&&(this._filterString=
d,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var d=document.activeElement,e=this._keyAssistDiv,d=e===d||0!==(e.compareDocumentPosition(d)&16);e.style.display="none";d&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(d){d=this._providers.indexOf(d);-1!==d&&this._providers.splice(d,
1)},select:function(d){var e=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===e.length)this._selectedIndex=-1;else{var b=this._selectedIndex,b=(b+(d?1:-1))%e.length;0>b&&(b=e.length-1);-1!==this._selectedIndex&&(d=e[this._selectedIndex],d.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=b;if(-1!==this._selectedIndex){this._selectedRow=d=e[this._selectedIndex];d.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",d.id);this._keyAssistTable.focus();
var e=d.getBoundingClientRect(),f=this._keyAssistContents,c=f.getBoundingClientRect();d.offsetTop<f.scrollTop?0===b?f.scrollTop=0:d.scrollIntoView(!0):e.bottom>c.bottom&&d.scrollIntoView(!1)}}},show:function(){this.isVisible()||(this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(0.75*this._keyAssistDiv.parentNode.clientHeight)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select())},_keyDown:function(d){if(40===d.keyCode)this.select(!0);else if(38===d.keyCode)this.select(!1);else if(13===d.keyCode)this.execute();else return;d.preventDefault()},_scrollWheel:function(d){var e=0,e=k.isIE||k.isOpera?-d.wheelDelta:k.isFirefox?40*d.detail:-d.wheelDeltaY,b=this._keyAssistContents,f=b.scrollTop;b.scrollTop+=e;if(f!==b.scrollTop)return d.preventDefault&&d.preventDefault(),!1}};return{KeyAssistPanel:e}});
define("orion/widgets/themes/ThemePreferences",[],function(){function g(g,k){this._preferences=g;this._themeData=k;var e=k.getThemeStorageInfo();this._themeVersion=e.version;var d=g.listenForChangedSettings(e.storage,2,function(e){e.key===d&&this.apply()}.bind(this))}g.prototype={_initialize:function(g,k,e){var d,h;void 0===this._themeVersion||e.get("version")===this._themeVersion?(d=e.get(g.styleset),(h=e.get("selected"))&&(h=JSON.parse(h))):h=d=null;d||(d=k.getStyles(),e.put(g.styleset,JSON.stringify(d)));
if(!h||void 0===h[g.selectedKey])h=h||{},h[g.selectedKey]=g.defaultTheme,e.put("selected",JSON.stringify(h));e.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(g){var k=this._themeData,e=k.getThemeStorageInfo();this._preferences.getPreferences(e.storage,2).then(function(d){this._initialize(e,k,d);var h=JSON.parse(d.get("selected"));d=JSON.parse(d.get(e.styleset));var b;if(d)for(var f=0;f<d.length;f++)if(d[f].name===h[e.selectedKey]){b=d[f];break}g({style:b,styles:d})}.bind(this))},
setTheme:function(g,k){var e=this._themeData,d=e.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(h){this._initialize(d,e,h);var b=JSON.parse(h.get("selected"));g||(g=b[d.selectedKey]);b[d.selectedKey]=g;h.put("selected",JSON.stringify(b));k?h.put(d.styleset,JSON.stringify(k)):k=JSON.parse(h.get(d.styleset));for(var f=0;f<k.length;f++)if(k[f].name===b[d.selectedKey]){e.processSettings(k[f]);break}h.put("version",this._themeVersion)}.bind(this))},setFontSize:function(g){var k=
this._themeData,e=k.getThemeStorageInfo();this._preferences.getPreferences(e.storage,2).then(function(d){this._initialize(e,k,d);var h=JSON.parse(d.get("selected")),b=JSON.parse(d.get(e.styleset)),f;if(b)for(var c=0;c<b.length;c++)b[c].fontSize=g,b[c].name===h[e.selectedKey]&&(f=b[c]);d.put(e.styleset,JSON.stringify(b));k.processSettings(f)}.bind(this))}};return{ThemePreferences:g}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
"Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value","JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item",
"Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",
EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",
smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",
scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair \x3cAngle\x3e Brackets",
autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated","Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:",
"Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color","Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute",
"Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute","CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: "});
define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/editor/eventTarget",[],function(){function g(){}g.addMixin=function(l){var k=g.prototype,e;for(e in k)k.hasOwnProperty(e)&&(l[e]=k[e])};g.prototype={addEventListener:function(g,k,e){this._eventTypes||(this._eventTypes={});var d=this._eventTypes[g];d||(d=this._eventTypes[g]={level:0,listeners:[]});d.listeners.push({listener:k,useCapture:e})},dispatchEvent:function(g){var k=g.type;this._dispatchEvent("pre"+k,g);this._dispatchEvent(k,g);this._dispatchEvent("post"+k,g)},_dispatchEvent:function(g,
k){var e=this._eventTypes?this._eventTypes[g]:null;if(e){var d=e.listeners;try{if(e.level++,d)for(var h=0,b=d.length;h<b;h++)if(d[h]){var f=d[h].listener;"function"===typeof f?f.call(this,k):f.handleEvent&&"function"===typeof f.handleEvent&&f.handleEvent(k)}}finally{if(e.level--,e.compact&&0===e.level){for(h=d.length-1;0<=h;h--)d[h]||d.splice(h,1);0===d.length&&delete this._eventTypes[g];e.compact=!1}}}},isListening:function(g){return!this._eventTypes?!1:void 0!==this._eventTypes[g]},removeEventListener:function(g,
k,e){if(this._eventTypes){var d=this._eventTypes[g];if(d){for(var h=d.listeners,b=0,f=h.length;b<f;b++){var c=h[b];if(c&&c.listener===k&&c.useCapture===e){0!==d.level?(h[b]=null,d.compact=!0):h.splice(b,1);break}}0===h.length&&delete this._eventTypes[g]}}}};return{EventTarget:g}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(g,l,k){function e(d){d=d||{};this._document=d.document||document}var d={};e.getTheme=function(h){h=h||"default";var b=d[h];b||(b=d[h]=new e);return b};e.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(d,b){var f=this,c=f._themeClass;f._themeClass=d;this._load(d,b,function(){f.onThemeChanged({type:"ThemeChanged",oldValue:c,newValue:f.getThemeClass()})})},onThemeChanged:function(d){return this.dispatchEvent(d)},
buildStyleSheet:function(d,b){function f(b,a,f){a&&(c.push("."+d+" ."+b+" {"),c.push("\t"+(f?"background-color":"color")+": "+a+";"),c.push("}"))}var c=[];c.push("");c.push("."+d+" {");b.fontFamily&&c.push("\tfont-family: "+b.fontFamily+";");b.fontSize&&c.push("\tfont-size: "+b.fontSize+";");b.fontSize&&c.push("\tcolor: "+b.text+";");c.push("}");c.push("."+d+".textview {");b.background&&c.push("\tbackground-color: "+b.background+";");c.push("}");f("ruler.annotations",b.annotationRuler,!0);f("ruler.lines",
b.annotationRuler,!0);f("ruler.folding",b.annotationRuler,!0);f("ruler.overview",b.overviewRuler,!0);f("rulerLines",b.lineNumber,!1);f("rulerLines.even",b.lineNumberEven,!1);f("rulerLines.odd",b.lineNumberOdd,!1);f("annotationLine.currentLine",b.currentLine,!0);f("entity-name-tag",b.keyword,!1);f("entity-other-attribute-name",b.attribute,!1);f("string-quoted",b.string,!1);f("meta.annotation.currentLine",b.currentLine,!0);f("keyword",b.keyword,!1);f("string",b.string,!1);f("comment",b.comment,!1);
f("comment.block.documentation",b.comment,!1);f("keyword.other.documentation.markup",b.comment,!1);return c.join("\n")},_createStyle:function(d,b,f,c){var m=this._document;d="orion-theme-"+d;var a=m.getElementById(d);if(a){if(c||a.firstChild.data===b)return;a.removeChild(a.firstChild);a.appendChild(m.createTextNode(b))}else c?(a=k.createElement(m,"link"),a.rel="stylesheet",a.type="text/css",a.href=b,a.addEventListener("load",function(){f()})):(a=k.createElement(m,"style"),a.appendChild(m.createTextNode(b))),
a.id=d,(m.getElementsByTagName("head")[0]||m.documentElement).appendChild(a);c||f()},_load:function(d,b,f){if(d)if("string"===typeof b)this._createStyle(d,b,f);else if(b=b.href,".css"!==b.substring(b.length-4)&&(b+=".css"),/^\//.test(b)||/[a-zA-Z0-9]+:\/\//i.test(b)||!g.toUrl)this._createStyle(d,b,f,!0);else{var c=this;g(["text!"+b],function(b){c._createStyle(d,b,f,!1)})}else f()}};l.EventTarget.addMixin(e.prototype);return{TextTheme:e}});
define("orion/widgets/themes/ThemeClass",[],function(){function g(g){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=g;this.classString="."+g+"{ "}g.prototype.className=null;g.prototype.classString=void 0;g.prototype.style=void 0;g.prototype.closeString=" }\n";g.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:g}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(g){function l(){}l.prototype.navbar="white";l.prototype.button="#777777";l.prototype.location="#EFEFEF";l.prototype.selection="#cedce7";l.prototype.sidepanel="#F7F7F7";l.prototype.mainpanel="white";l.prototype.navtext="#bfbfbf";l.prototype.content="#3087B3";l.prototype.search="#444";l.prototype.toolpanel="white";l.prototype.writeNavigationStyle=function(){var k="",e=[],d=new g.ThemeClass("orionPage");
d.style.backgroundColor="#fdfdfd";d.style.width="100%";d.style.height="100%";e.push(d);d=new g.ThemeClass("topRowBanner");d.style.margin="0";d.style.border="0";d.style.backgroundColor=this.navbar;d.style.height="16px";d.style.padding="10px";d.style.paddingLeft="6px";d.style.paddingRight="2px";d.style.borderBottom="none";d.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";d.style.zIndex="100";e.push(d);d=new g.ThemeClass("a");d.style.textDecoration="none";d.style.color=
this.content;e.push(d);d=new g.ThemeClass("navlink");d.style.display="inline-block";d.style.padding="2px";d.style.color=this.content;d.style.verticalAlign="bottom";e.push(d);d=new g.ThemeClass("primaryNav");d.style.color=this.navtext;d.style.fontSize="8pt";d.style.fontWeight="normal";d.style.paddingTop="0";d.style.verticalAlign="baseline";e.push(d);d=new g.ThemeClass("primaryNav a");d.style.fontSize="8pt";d.style.color=this.navtext;d.style.marginRight="6px";d.style.marginLeft="6px";d.style.verticalAlign=
"baseline";d.style.textDecoration="none";e.push(d);d=new g.ThemeClass("primaryNav a:hover");d.style.color="#bfbfbf";d.style.cursor="hand";d.style.color="white";d.style.fontWeight="normal";e.push(d);for(var h in e)k+=e[h].toString();return k};l.prototype.writeLocationStyle=function(){var k="",e=[],d=new g.ThemeClass("titleArea");d.style.margin="0";d.style.paddingTop="5px";d.style.border="0";d.style.background=this.location;d.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";d.style.borderBottom="1px solid "+this.location;d.style.minHeight="20px";e.push(d);d=new g.ThemeClass("breadcrumb");d.style.fontSize="8pt";d.style.textDecoration="none";d.style.color="#f1f1f2;";d.style.paddingTop="2px";e.push(d);d=new g.ThemeClass("a.breadcrumb:hover");d.style.textDecoration="none";d.style.borderBottom="1px dotted";d.style.color="#F58B0F";d.style.cursor="pointer";e.push(d);d=new g.ThemeClass("breadcrumbSeparator");d.style.fontSize=
"8pt";d.style.textDecoration="none";d.style.color=this.separator;d.style.fontWeight="bold";e.push(d);d=new g.ThemeClass("currentLocation");d.style.fontWeight="bold";d.style.fontSize="8pt";d.style.color=this.breadcrumb;d.style.textDecoration="none";d.style.textWrap="normal";d.style.lineHeight="10pt";e.push(d);d=new g.ThemeClass("a.currentLocation:hover");d.style.fontWeight="bold";d.style.fontSize="10pt";d.style.color="#666666";d.style.textDecoration="none";d.style.borderBottom="0";e.push(d);d=new g.ThemeClass("navlinkonpage");
d.style.color=this.content;d.style.verticalAlign="middle";e.push(d);this.bannerProgress&&(d=new g.ThemeClass("topRowBanner .progressPane_running"),d.style.borderColor=this.bannerProgress,e.push(d));for(var h in e)k+=e[h].toString();return k};l.prototype.writeButtonStyle=function(){var k="",e=[],d=new g.ThemeClass("commandButton");d.style.color="#666";d.style.border="1px solid #dedede";d.style.backgroundColor="#ddd";d.style.textAlign="center";d.style.verticalAlign="middle";d.style.cursor="pointer";
d.style.display="inline-block";d.style.padding="4px 6px";d.style.borderRadius="3px";d.style.lineHeight="12px";d.style.fontSize="9pt";d.style.userSelect="none";e.push(d);d=new g.ThemeClass("commandButton:over");d.style.backgroundColor="#e6e6e6";d.style.border="1px solid #808080";e.push(d);d=new g.ThemeClass("commandMenu");d.style.color="#222";d.style.display="inline-block";d.style.verticalAlign="baseline";d.style.margin="0";d.style.fontSize="8pt";d.style.fontWeight="normal";d.style.border="1px solid #dedede";
d.style.backgroundColor="#efefef";d.style.cursor="pointer";d.style.borderRadius="1px";e.push(d);d=new g.ThemeClass("commandMenuItem");d.style.border="0";d.style.padding="0";d.style.margin="0";e.push(d);for(var h in e)k+=e[h].toString();return k};l.prototype.writeMainStyle=function(){var k="",e=[],d=new g.ThemeClass("searchbox");d.style.backgroundImage="url(../images/core_sprites.png)";d.style.backgroundRepeat="no-repeat";d.style.backgroundPosition="4px -297px";d.style.width="12px";d.style.height=
"12px";d.style.backgroundColor=this.search;d.style.border="1px solid "+this.search;d.style.fontSize="11px";d.style.width="15em";d.style.height="16px";d.style.borderRadius="10px";d.style.color="#999";d.style.padding="0";d.style.paddingLeft="20px";d.style.marginLeft="5px";d.style.marginTop="6px !important";d.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";e.push(d);d=new g.ThemeClass("searchbox:focus");d.style.color="white";d.style.outline=
"none";e.push(d);d=new g.ThemeClass("checkedRow");d.style.cssText="background-color:"+this.selection+" !important;";e.push(d);d=new g.ThemeClass("navbar-item-selected");d.style.background=this.selection;d.style.color=this.content;e.push(d);d=new g.ThemeClass("auxpane");d.style.border="0";d.style.background=this.sidepanel;e.push(d);d=new g.ThemeClass("mainpane");d.style.background=this.mainpanel;d.style.border=0;e.push(d);d=new g.ThemeClass("mainToolbar");d.style.background=this.toolpanel;e.push(d);
for(var h in e)k+=e[h].toString();return k};l.prototype.render=function(g){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};l.prototype.getSheet=function(g){g.navbar.value?(this.navbar=g.navbar.value,this.button=g.button.value,this.location=g.location.value,this.selection=g.selection.value,this.sidepanel=g.sidepanel.value,this.mainpanel=g.mainpanel.value,this.navtext=g.navtext.value,this.search=
g.search.value,this.content=g.content.value,this.toolpanel=g.toolpanel.value,this.bannerProgress=g.bannerProgress.value):(this.navbar=g.navbar,this.button=g.button,this.location=g.location,this.selection=g.selection,this.sidepanel=g.sidepanel,this.mainpanel=g.mainpanel,this.navtext=g.navtext,this.search=g.search,this.content=g.content,this.toolpanel=g.toolpanel,this.bannerProgress=g.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:l}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(g,l,k){function e(){}function d(){this.styles=[];var b=new e;b.name="Orion";b.navbar="white";b.button="#EFEFEF";b.location="#efefef";b.selection="FEC";b.sidepanel="#FBFBFB";b.mainpanel="white";b.toolpanel="white";b.navtext="#bfbfbf";b.content="#3087B3";b.search="#444";b.breadcrumb="#3087B3";b.separator="#333";b.bannerProgress="whitesmoke";
this.styles.push(b);b=new e;b.name="Orion2014";b.navbar="white";b.button="#EFEFEF";b.location="#EFEFEF";b.selection="FEC";b.sidepanel="#EEEEEE";b.mainpanel="#EEEEEE";b.toolpanel="#EEEEEE";b.navtext="#BFBFBF";b.content="#333333";b.search="#444444";b.breadcrumb="#333333";b.separator="#333333";b.bannerProgress="orange";this.styles.push(b);b=new e;b.name="Green Zone";b.navbar="seagreen";b.button="lavender";b.location="darkseagreen";b.selection="moccasin";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel=
"white";b.navtext="#FBFBFB";b.content="darkgreen";b.search="darkgreen";b.breadcrumb="#3087B3";b.separator="seagreen";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name="Pretty In Pink";b.navbar="plum";b.button="lavender";b.location="pink";b.selection="lavender";b.sidepanel="seashell";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumorchid";b.search="violet";b.breadcrumb="#3087B3";b.separator="plum";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name=
"Blue Monday";b.navbar="cornflowerblue";b.button="lavender";b.location="skyblue";b.selection="lavender";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="royalblue";b.search="royalblue";b.breadcrumb="#3087B3";b.separator="cornflowerblue";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name="Vanilla Skies";b.navbar="sandybrown";b.button="lemmonchiffon";b.location="cornsilk";b.selection="lemonchiffon";b.sidepanel="white";b.mainpanel="white";b.toolpanel=
"white";b.navtext="lemonchiffon";b.content="chocolate";b.search="moccasin";b.breadcrumb="#3087B3";b.separator="sandybrown";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name="Beetlejuice";b.navbar="indigo";b.button="slateblue";b.location="darkslateblue";b.selection="silver";b.sidepanel="lavender";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumslateblue";b.search="#444";b.breadcrumb="#3087B3";b.separator="indigo";b.bannerProgress="#F2F2F2";this.styles.push(b);
b=new e;b.name="Red";b.navbar="#CD2127";b.button="#777777";b.location="#D85F56";b.selection="lightcoral";b.sidepanel="#EFDAB2";b.mainpanel="#FDFADD";b.toolpanel="#FDFADD";b.navtext="#FBFBFB";b.content="darkred";b.search="#D85F56";b.breadcrumb="darkred";b.separator="#CD2127";b.bannerProgress="#F2F2F2";this.styles.push(b)}function h(){return this.styles}e.prototype.name="Orion";e.prototype.navbar="#404648";e.prototype.button="#EFEFEF";e.prototype.location="#333";e.prototype.breadcrumb="#3087B3";e.prototype.separator=
"#333";e.prototype.selection="FEC";e.prototype.sidepanel="#FBFBFB";e.prototype.mainpanel="white";e.prototype.toolpanel="white";e.prototype.navtext="#bfbfbf";e.prototype.content="#3087B3";e.prototype.search="#444";e.prototype.bannerProgress="white";d.prototype.styles=[];d.prototype.getStyles=h;d.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};d.prototype.getViewData=function(){var b={top:10,left:10,
width:350,height:350};b.shapes=[{type:"RECTANGLE",name:g["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:g["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:g["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:g["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:g["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:g.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:g["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:g.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:g.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:g.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:g["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:g.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:g["Button Text"],label:"Button",x:158,y:90,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",
name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:g["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:g["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:g["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:g["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:g["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:g["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},
{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var f=0;3>f;f++)b.shapes.push({type:"TEXT",name:g.Content,label:"org.eclipse.orion.content",x:170,y:127+20*f,fill:"#3087B3",family:"content"});for(f=0;3>f;f++)b.shapes.push({type:"TEXT",name:g.Content,label:"Item",x:25,y:115+20*f,fill:"#3087B3",family:"content"});for(f=0;3>f;f++)b.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+20*f,x2:165,y2:124+20*f,x3:160,y3:127+20*f,family:"navbar",fill:"#333"});b.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return b};d.prototype.processSettings=function(b){var f=new k.ThemeSheetWriter;(new l.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",f.getSheet(b))};return{ThemeData:d,getStyles:h}});
define("orion/widgets/nls/root/messages",{"no input":"no input","no output":"no output","Choose a Folder":"Choose a Folder",OK:"OK",Profile:"Profile","Sign out":"Sign out","N/A":"N/A","logged in since ":"logged in since ","Sign in":"Sign in","Authentication required!":"Authentication required!","Name:":"Name:","Plug-ins":"Plug-ins"," \x3cNo available services or timed out, check URL and try reloading\x3e":" \x3cNo available services or timed out, check URL and try reloading\x3e",Properties:"Properties",
" (Service Id: ":" (Service Id: ",Services:"Services","SFTP Transfer":"SFTP Transfer","Remote host:":"Remote host:","Port:":"SFTP Port:","Remote path:":"Remote path:","User name:":"User name:","Password:":"Password:","Start Transfer":"Start Transfer","Location:":"Location:","orion.sftpConnections":"orion.sftpConnections","Drag a file here":"Drag a file here","unzip zips":"Unzip *.zip files","or if you prefer":"(or upload a file using the buttons below)",Upload:"Upload","Browse...":"Browse...","Import a file or zip":"Import a file or zip",
"Missing required argument: searchRenderer":"Missing required argument: searchRenderer","Missing required argument: favService":"Missing required argument: favService","Find File Named":"Find File Named","Type the name of a file to open (? \x3d any character, * \x3d any string):":"Type the name of a file to open (? \x3d any character, * \x3d any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","\x3c/a\x3e":"\x3c/a\x3e","\x3e":"\x3e","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(g){function l(k,e,d){this.elements=d;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='\x3cheader class\x3d"UAHeader"\x3eDevelop software from within the cloud\x3c/header\x3e';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className=
"UAContainer-body";this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);!0===e?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className=
"UAModalBackground",document.body.appendChild(this.backdrop),document.body.appendChild(this.container),g.addAutoDismiss([this.container],this.destroy.bind(this))):k.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}l.prototype.elementNode=null;l.prototype.switchesContainer=null;l.prototype.switches=null;l.prototype.radioButtons=null;l.prototype.chosenSwitch=
null;l.prototype.addElement=function(g){var e=document.createElement("span");e.className="UAContainer-icon";e.innerHTML='\x3cspan class\x3d"workingSpan"\x3e\x3cimg src\x3d"'+g.image+'" id\x3d"'+g.label+'ImageNode" alt\x3d"'+g.alt+'" height\x3d"64" width\x3d"64"\x3e\x3c/span\x3e\x3cspan class\x3d"UAIcon-label"\x3e\x3cspan class\x3d"UALabel" id\x3d"'+g.label+'LabelNode" \x3e'+g.label+"\x3c/span\x3e\x3c/span\x3e";e.onmouseover=function(){document.getElementById(g.label+"ImageNode").src=g.secondaryImage;
document.getElementById(g.label+"LabelNode").className="UALabel-live";e.className="UAContainer-icon-live"};e.onmouseout=function(){document.getElementById(g.label+"ImageNode").src=g.image;document.getElementById(g.label+"LabelNode").className="UALabel";e.className="UAContainer-icon"};var d=this;e.onclick=function(){d.showMedia(g)};this.elementNode.appendChild(e)};l.prototype.clearElements=function(){this.elementNode.innerHTML=""};l.prototype.showMedia=function(g){this.clearElements();this.addElement(g);
var e=document.createElement("span");e.className="UAContainer-media";e.innerHTML='\x3cdiv\x3e\x3c/div\x3e\x3cdiv\x3e\x3c/div\x3e\x3cspan class\x3d"mediaSpan"\x3e\x3cimg src\x3d"'+g.media+'" alt\x3d"'+g.alt+'" height\x3d"300" width\x3d"400"\x3e\x3c/span\x3e';this.elementNode.appendChild(e);setTimeout(function(){e.style.opacity=1},100);g=document.getElementById(g.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=g.parentNode;g.className="chosenCircle"};l.prototype.createSwitch=
function(g){var e;e=g?g.label+"switch":"indexSwitch";var d=document.createElement("span");d.className="workingSpan";d.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+e+'"\x3e\x3c/div\x3e';var h=this;d.onclick=g?function(){h.showMedia(g)}:function(){h.initialize();h.chosenSwitch.firstChild.className="circle";h.chosenSwitch=d;h.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(d);return this.radioButtons[this.radioButtons.length]=d};l.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};l.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return l});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(g,l,k,e){function d(){}var h=null;d.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'\x3cdiv class\x3d"dialog" role\x3d"dialog"\x3e\x3cdiv class\x3d"dialogTitle"\x3e\x3cspan id\x3d"title" class\x3d"dialogTitleText layoutLeft"\x3e\x3c/span\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" id\x3d"closeDialog"\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv id\x3d"dialogContent" class\x3d"dialogContent layoutBlock"\x3e\x3c/div\x3e\x3cdiv id\x3d"buttons" class\x3d"dialogButtons"\x3e\x3c/div\x3e\x3c/div\x3e',_initialize:function(){var b=
document.body;this.$frameParent=b;this.$$modalExclusions=this.$$modalExclusions||[];var f=document.createRange();f.selectNode(b);f=f.createContextualFragment(this.CONTAINERTEMPLATE);b.appendChild(f);this.$frame=b.lastChild;this.title&&k.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=k.$("#closeDialog",this.$frame);var c=this;this.$close.addEventListener("click",function(b){c.hide()},!1);this.$parent=k.$(".dialogContent",this.$frame);f=document.createRange();f.selectNode(this.$parent);
b=f.createContextualFragment(this.TEMPLATE);this.messages&&k.processTextNodes(b,this.messages);this.$parent.appendChild(b);this.$buttonContainer=k.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(b){b.keyCode===k.KEY.ESCAPE?c.hide():b.keyCode===k.KEY.ENTER&&"function"===typeof c._defaultCallback&&c._defaultCallback()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent);this.modal&&this._makeModal()},
_makeButtons:function(){if(this.$buttonContainer&&Array.isArray(this.buttons)){var b=this;this.buttons.forEach(function(f){var c=e.createButton(f.text,f.callback);f.id&&(c.id=f.id,b["$"+c.id]=c);f.isDefault&&(b._defaultCallback=f.callback,b._defaultButton=c);b.$buttonContainer.appendChild(c)})}},_makeModal:function(b){var f=this;this.$frame.addEventListener("blur",function(a){f.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var c=!k.contains(f.$frame,a.target);if(c)for(var b=0;b<
f.$$modalExclusions.length;b++)if(k.contains(f.$$modalExclusions[b],a.target)){c=!1;break}c&&(window.setTimeout(function(){(f.$lastFocusedElement||f.$parent).focus()},0),k.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);b=this.$frameParent.childNodes;var c=!1;this._addedBackdrop=[];for(var d=0;d<b.length;d++){for(var a=0;a<this.$$modalExclusions.length;a++)if(k.contains(this.$$modalExclusions[a],b[d])){c=
!0;break}!c&&b[d]!==f.$frame&&b[d].classList&&!b[d].classList.contains("tooltipContainer")&&(a=b[d],a.classList.contains("modalBackdrop")||(a.classList.add("modalBackdrop"),this._addedBackdrop.push(a)))}(b=k.lastTabbable(this.$buttonContainer)||k.lastTabbable(this.$parent))&&b.addEventListener("keydown",function(a){if(a.keyCode===k.KEY.TAB){var c=f._getFirstFocusField();c&&c!==a.target&&c.focus();k.stop(a)}},!1)},_addChildDialog:function(b){this.$$modalExclusions.push(b.$frame||b.$parent)},_inModalExclusion:function(b){return this.$$modalExclusions.some(function(f){return b.$frame===
f||b.$parent===f})},_bindElements:function(b){for(var f=0;f<b.childNodes.length;f++){var c=b.childNodes[f];c.id&&(this["$"+c.id]=c);this._bindElements(c)}},hide:function(b){!b&&h===this&&(h=null);"function"===typeof this._beforeHiding&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");k.setFramesEnabled(!0);"function"===
typeof this._afterHiding&&this._afterHiding();var f=this;this.keepAlive||window.setTimeout(function(){f.destroy()},0)},show:function(b){if(this.modal)if(h){if(!h._inModalExclusion(this)){this.hide(!0);return}}else h=this;"function"===typeof this._beforeShowing&&this._beforeShowing();k.setFramesEnabled(!1);var f=k.bounds(this.$frame),c=k.bounds(document.documentElement),d;b?(d=k.bounds(b),b=d.top+d.height+4,d=d.left+4,b+f.height>c.height&&(b=Math.max(0,c.height-f.height-4)),d+f.width>c.width&&(d=Math.max(0,
c.width-f.width-4))):(d=Math.max(0,(c.width-f.width)/2),b=Math.max(0,(c.height-f.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=b+"px";this.$frame.style.left=d+"px";this.$frame.classList.add("dialogShowing");"function"===typeof this._afterShowing&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return k.firstTabbable(this.$parent)||this._defaultButton||k.firstTabbable(this.$buttonContainer)||this.$close},
destroy:function(){this.$frame&&(h===this&&(h=null),k.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(b){b.classList.remove("modalBackdrop")}),this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0),this.$frameParent.removeChild(this.$frame),this.$parent=this.$frame=void 0)}};d.prototype.constructor=d;return{Dialog:d}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages require orion/webui/littlelib orion/PageLinks orion/widgets/userAssistance/UATaskPanel orion/webui/dialog orion/webui/dropdown".split(" "),function(g,l,k,e,d,h,b){function f(c){this._displaySignOut=!0;this._init(c)}f.prototype={_init:function(c){this._dropdownNode=k.node(c.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=c.dropdown;this._serviceRegistry=c.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=c.noSeparator;this._dropDownItemClass=c.dropDownItemClass;this._keyAssistClass=c.keyAssistClass;void 0!==c.signOut&&(this._displaySignOut=c.signOut)},isSingleService:function(){return 1===this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},hasServices:function(){return 0<this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},length:function(c){var b=0,a;for(a in c)c.hasOwnProperty(a)&&b++;
return b},_makeMenuItem:function(c,f){var a=b.createMenuItem(c).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&a.classList.add(this._dropDownItemClass);a.addEventListener("click",f,!1);a.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&f()},!1);return a},_renderAuthenticatedService:function(c,b){var a=this,f=this.authenticatedServices[c].authService;if(f&&f.logout&&this._displaySignOut){var d=this._makeMenuItem(g["Sign Out"],
function(){f.logout().then(function(){a.addUserItem(c,f,a.authenticatedServices[c].label);localStorage.removeItem(c);localStorage.removeItem("lastLogin");for(var b=localStorage.length-1;0<=b;b--){var d=localStorage.key(b);d&&0===d.indexOf("/orion/preferences/user")&&localStorage.removeItem(d)}f.getAuthForm(window.location.href).then(function(a){window.location=a})})});this._dropdownNode.appendChild(d.parentNode)}},renderServices:function(){function c(c){a[c]||(a[c]=f.createDocumentFragment());return a[c]}
var f=document,a=[],d=this._serviceRegistry;e.getPageLinksInfo(d,"orion.page.link.user").then(function(e){this._dropdown?this._dropdown.empty():this._dropdownNode&&k.empty(this._dropdownNode);e.getAllLinks().forEach(function(a){var b,d;if(a.category&&(d=/user\.(\d+)/.exec(a.category)))b=parseInt(d[1],10);if("number"!==typeof b||isNaN(b))b=1;b=c(b);d=f.createElement("li");var e=f.createElement("a");e.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&e.classList.add(this._dropDownItemClass):
e.classList.add("dropdownMenuItem");e.href=a.href;e.textContent=a.textContent;d.appendChild(e);b.appendChild(d);e.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&e.click()},!1)}.bind(this));this.keyAssistFunction&&(e=this._makeMenuItem(g["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&e.classList.add(this._keyAssistClass):e.classList.add("key-assist-menuitem"),e=e.parentNode,c(0).appendChild(e));
if(e=d.getServiceReferences("orion.page.getstarted")[0])e=e.getProperty("data"),e=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,e)).parentNode,c(0).appendChild(e);var h=this;a.sort(function(a,c){return a-c}).forEach(function(c,f){if(f<a.length-1&&!this._noSeparator){var d=b.createSeparator();c.appendChild(d)}h._dropdownNode.appendChild(c)}.bind(this));if(this.isSingleService())for(var t in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(t)&&this._renderAuthenticatedService(t,
0)}.bind(this))},getStartedDialog:function(c){new d(null,!0,c)},setKeyAssist:function(c){this.keyAssistFunction=c;this.renderServices()},addUserItem:function(c,b,a,f){f?(this.unauthenticatedServices[c]&&delete this.unauthenticatedServices[c],this.authenticatedServices[c]={authService:b,label:a,data:f}):(this.authenticatedServices[c]&&delete this.authenticatedServices[c],this.unauthenticatedServices[c]=this.unauthenticatedServices[c]?{authService:b,label:a,pending:this.unauthenticatedServices[c].pending}:
{authService:b,label:a});this.renderServices()}};f.prototype.constructor=f;return{UserMenu:f}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(g,l,k,e,d,h){function b(c,b,a){var f="";a&&(f="^");if(f=k.parse("/"+f+c.searchStr+"/"))a=f.pattern,f=f.flags,-1===f.indexOf("i")&&!b.caseSensitive&&(f+="i"),c.regExp={pattern:a,flags:f},c.wildCard=!0}var f={ALL_FILE_TYPE:"*.*",doSearch:function(c,b,a,d){if(c){var e=!0;"*"===a&&(a="");""===a&&(e=d&&d.type!==f.ALL_FILE_TYPE);e&&(""!==a&&f.addRecentSearch(b,
a,d?d.regEx:!1),c=c.createSearchParams(a,!1,!1,d),c=f.generateSearchHref(c),window.location=c)}else window.alert(g["Can't search: no search service is available"])},generateSearchHelper:function(c,d){var a=c.keyword,e=a,h={};c.fileType&&c.fileType!==f.ALL_FILE_TYPE&&""===a&&(e="*."+c.fileType);if(c.regEx)h.searchStr=a,b(h,c,d);else{var g=-1<a.indexOf("*"),k=-1<a.indexOf("?");g&&(a=a.split("*").join(".*"));k&&(a=a.split("?").join("."));!g&&!k&&!c.nameSearch?(h.searchStr=c.caseSensitive?a.split("\\").join(""):
a.split("\\").join("").toLowerCase(),h.wildCard=!1):(h.searchStr=c.caseSensitive?a:a.toLowerCase(),b(h,c,d),h.wildCard=!0)}h.searchStrLength=h.searchStr.length;return{params:c,inFileQuery:h,displayedSearchTerm:e}},convertSearchParams:function(c){void 0!==c.rows&&(c.rows=parseInt(c.rows,10));void 0!==c.start&&(c.start=parseInt(c.start,10));"string"===typeof c.regEx&&(c.regEx="true"===c.regEx.toLowerCase());"string"===typeof c.caseSensitive&&(c.caseSensitive="true"===c.caseSensitive.toLowerCase());
"string"===typeof c.nameSearch&&(c.nameSearch="true"===c.nameSearch.toLowerCase())},copySearchParams:function(c,b){var a={},f;for(f in c)if(void 0!==c[f]&&null!==c[f]&&(b||"replace"!==f))a[f]=c[f];return a},generateSearchHref:function(c){var b=l.toUrl("search/search.html");c=f.copySearchParams(c,!0);var a=c.resource;c.resource=void 0;return"undefined"!==typeof c.keyword?(new h(b+"#{,resource,params*}")).expand({resource:a,params:c}):(new h(b+"#{,resource}")).expand({resource:a})},generateFindURLBinding:function(c,
b,a,f,d){c={find:b.searchStr,regEx:b.wildCard?!0:void 0,caseSensitive:c.caseSensitive?!0:void 0,replaceWith:"string"===typeof f?f:void 0,atLine:"number"===typeof a?a:void 0};return d?c:","+(new h("{,params*}")).expand({params:c})},convertFindURLBinding:function(c){"string"===typeof c.regEx&&(c.regEx="true"===c.regEx.toLowerCase());"string"===typeof c.caseSensitive&&(c.caseSensitive="true"===c.caseSensitive.toLowerCase());"string"===typeof c.atLine&&(c.atLine=parseInt(c.atLine,10))},replaceRegEx:function(c,
b,a){return c.replace(RegExp(b.pattern,b.flags),a)},replaceStringLiteral:function(c,b,a){b=k.parse("/"+b+"/gim");return f.replaceRegEx(c,b,a)},searchOnelineLiteral:function(c,b,a){var f;f=0;for(var d=!1,e=[];!(f=b.indexOf(c.searchStr,f),0>f);){e.push({startIndex:f,length:c.searchStrLength});d=!0;if(a)break;f+=c.searchStrLength}return d?e:null},findRegExp:function(c,b,a,f){if(!b)return null;a=a||"";a+=(-1===a.indexOf("g")?"g":"")+(-1===a.indexOf("m")?"m":"");var d=null;return(d=RegExp(b,a).exec(c.substring(f)))&&
{startIndex:d.index+f,length:d[0].length}},searchOnelineRegEx:function(c,b,a){for(var d=0,e=!1,h=[];;)if(d=f.findRegExp(b,c.regExp.pattern,c.regExp.flags,d)){h.push(d);e=!0;if(a)break;d=d.startIndex+d.length}else break;return e?h:null},generateNewContents:function(c,b,a,d,e,h){if(d&&b){c||(a.contents=[]);for(var g=0;g<b.length;g++){for(var k=b[g],l=!1,v=!1,x=[],z,A=0,C=0;C<d.children.length;C++)if(d.children[C].lineNumber-1===g){A=C;for(l=0;l<d.children[C].matches.length;l++)!1!==d.children[C+l].checked&&
x.push(l);v=0<x.length;z=d.children[C].matches;l=!0;break}if(l){if(v){x=f.replaceCheckedMatches(k,e,z,x,h);k=x.replacedStr;for(l=0;l<d.children[A].matches.length;l++)d.children[A+l].newMatches=x.newMatches}else for(l=0;l<d.children[A].matches.length;l++)d.children[A+l].newMatches=d.children[A+l].matches;c?a.contents[g]=k:a.contents.push(k)}else c||a.contents.push(k)}}},generateMatchContext:function(c,b,a){var f=[],d=2*c+1,e;b.length<=d?(e=0,c=b.length-1):(e=a-c,0>e?(e=0,c=e+d-1):(c=a+c,c>b.length-
1&&(c=b.length-1,e=c-d+1)));for(d=e;d<=c;d++)f.push({context:b[d],current:d===a});return f},splitFile:function(c){for(var b=0,a=0,f=0,d=0,e=[];;){-1!==b&&b<=f&&(b=c.indexOf("\r",f));-1!==a&&a<=f&&(a=c.indexOf("\n",f));if(-1===a&&-1===b){e.push(c.substring(d));break}var h=1;-1!==b&&-1!==a?b+1===a?(h=2,f=a+1):f=(b<a?b:a)+1:f=-1!==b?b+1:a+1;e.push(c.substring(d,f-h));d=f}return e},searchWithinFile:function(c,b,a,d,e,h){a=f.splitFile(a);e&&(b.contents=a);if(b){b.children=[];for(var g=d=0;g<a.length;g++){var k=
a[g];if(k&&0<k.length){var l=h?k:k.toLowerCase();if(l=c.wildCard?f.searchOnelineRegEx(c,l):f.searchOnelineLiteral(c,l)){var v,x=g+1;if(e)for(var z=0;z<l.length;z++)v=z+1,v={parent:b,checked:b.checked,type:"detail",matches:l,lineNumber:x,matchNumber:v,name:k,location:b.location+"-"+x+"-"+v},b.children.push(v);else v={parent:b,context:f.generateMatchContext(2,a,g),checked:b.checked,type:"detail",matches:l,lineNumber:x,name:k,location:b.location+"-"+x},b.children.push(v);d+=l.length}}}b.totalMatches=
d}},replaceCheckedMatches:function(c,b,a,f,d){for(var e=0,h="",g=[],k=0;k<a.length;k++){e!==a[k].startIndex&&(h+=c.substring(e,a[k].startIndex));a[k].length&&(d=a[k].length);for(var e=!1,l=0;l<f.length;l++)if(f[l]===k){e=!0;break}e?(g.push({startIndex:h.length,length:b.length}),h+=b):(g.push({startIndex:h.length,length:d}),h+=c.substring(a[k].startIndex,a[k].startIndex+d));e=a[k].startIndex+d}e<c.length&&(h+=c.substring(e));return{replacedStr:h,newMatches:g}},fullPathNameByMeta:function(c){var b=
c.length,a="";if(0<b)for(b-=1;-1<b;b--)a=a+(""===a?"":"/")+c[b].Name;return a},path2FolderName:function(c,b,a){return c.substring(0,c.length-b.length-(a?0:1))},_storeRecentSearch:function(c,b,a,f){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("recentSearch",b);a&&window.setTimeout(function(){a.dispatchEvent({type:"inputDataListChanged",deleting:f})}.bind(this),20)})},addRecentSearch:function(c,b,a){"string"===typeof b&&b&&c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var e;
d=d.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));if(d){for(e in d)if(d[e].name===b)return;20<=d.length&&d.splice(19,d.length-20+1)}else d=[];d.splice(0,0,{name:b,regEx:a});f._storeRecentSearch(c,d)})},removeRecentSearch:function(c,b,a){"string"===typeof b&&b&&c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var e;d=d.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));if(d)for(e in d)if(d[e].name===b){d.splice(e,1);f._storeRecentSearch(c,
d,a,!0);break}})},getSearches:function(c,b,a){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c=c.get(b);"string"===typeof c&&(c=JSON.parse(c));c&&a&&a(c)})},getMixedSearches:function(c,b,a,d){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var e=c.get("recentSearch");"string"===typeof e&&(e=JSON.parse(e));b&&(c=c.get("search"),"string"===typeof c&&(c=JSON.parse(c)),c&&c.forEach(function(c){if(a){var b=f.parseQueryStr(c.query);
e.some(function(a){return b.searchStrTitle===a.name})||e.push({name:b.searchStrTitle,label:c.name})}else e.push({name:null,label:c.name,value:c.query})}));e&&d&&d(e)})},getOpenSearchPref:function(c,b){c.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");b(a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(c,b){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",
{openInNewTab:b})})}};return f});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(g,l,k,e,d,h){function b(b,c,d,a){this.registry=b;this.fileClient=c;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=a&&a.searchOnName;this._buildSkeletonOnly=a&&a.buildSkeletonOnly;this._fetchChildrenCallBack=a&&a.fetchChildrenCallBack;this._searchParams=d;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:e.generateSearchHelper(d);this._location=a&&a.location;this._childrenLocation=a&&a.childrenLocation?a.childrenLocation:this._location;this._reportOnCancel=a&&a.reportOnCancel;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}b.prototype.search=function(b){var c=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=b;this._cancelled=!1;this._deferredArray=[];c.getContentTypes().then(function(c){this.contentTypesCache=c;var a=this;this._visitRecursively(this._childrenLocation).then(function(){(!a._cancelled||a._reportOnCancel)&&a._reportResult();a._cancelled&&a._HandleStatus({name:"Cancel"})}.bind(a),function(c){a._reportResult();a._HandleStatus(c)}.bind(a))}.bind(this))};b.prototype.searchName=function(b,c){b&&(this._searchParams=
b,this.searchHelper=e.generateSearchHelper(b,!0));c&&(this.onSearchNameComplete=c);var d=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var a=0;a<this.fileSkeleton.length;a++){var n=this.fileSkeleton[a].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?e.searchOnelineRegEx(this.searchHelper.inFileQuery,n,!0):e.searchOnelineLiteral(this.searchHelper.inFileQuery,n,!0))if(d.push(this.fileSkeleton[a]),d.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:d.length,
docs:d}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};b.prototype.buildSkeleton=function(b,c){this._buildingSkeleton=!0;var d=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var a=this;b();d.getContentTypes().then(function(b){a.contentTypesCache=b;a._visitRecursively(a._childrenLocation).then(function(){a._buildingSkeleton=!1;c();a.searchHelper&&!a._buildSkeletonOnly&&a.searchName()})})};b.prototype._sort=function(b){b.sort(function(c,
b){var a,d;if("Path asc"===this._searchParams.sort){a=c.Location&&c.Location.toLowerCase();a=e.path2FolderName(a,c.Name&&c.Name.toLowerCase(),!0);d=b.Location&&b.Location.toLowerCase();d=e.path2FolderName(d,b.Name&&b.Name.toLowerCase(),!0);if(a<d)return-1;if(a>d)return 1}return this._sortOnNameSingle(c,b)}.bind(this))};b.prototype._HandleStatus=function(b){this._statusService&&"Cancel"===b.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:g["Search cancelled by user"],
Severity:"Warning"}))};b.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};b.prototype._sortOnNameSingle=function(b,c){var d=b.Name&&b.Name.toLowerCase(),a=c.Name&&c.Name.toLowerCase();return d<a?-1:d>a?1:0};b.prototype._onFileType=function(b){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===e.ALL_FILE_TYPE?!0:0<=b.extension.indexOf(this.searchHelper.params.fileType):
!0};b.prototype._visitRecursively=function(b){var c=[],e=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);return(e._progressService?this._progressService.progress(e.fileClient.fetchChildren(b),"Crawling search for children of "+b):e.fileClient.fetchChildren(b)).then(function(a){for(var b=0;b<a.length;b++)if(void 0!==a[b].Directory&&!1===a[b].Directory)if(e._searchOnName)c.push(e._buildSingleSkeleton(a[b]));else if(e._buildSkeletonOnly)c.push(e._buildSingleSkeleton(a[b]));else{if(!e._cancelled){var f=
d.getFilenameContentType(a[b].Name,e.contentTypesCache);if(f&&("text/plain"===f["extends"]||"text/plain"===f.id)&&e._onFileType(f))f=e._sniffSearch(a[b]),c.push(f),e._deferredArray.push(f)}}else if(a[b].Location)if(e._cancelled)break;else f=e._visitRecursively(a[b].ChildrenLocation),c.push(f),e._deferredArray.push(f);return h.all(c)})};b.prototype._hitOnceWithinFile=function(b){b=this._searchParams.caseSensitive?b:b.toLowerCase();return this.searchHelper.inFileQuery.wildCard?e.searchOnelineRegEx(this.searchHelper.inFileQuery,
b,!0):e.searchOnelineLiteral(this.searchHelper.inFileQuery,b,!0)};b.prototype._reportSingleHit=function(b){this._cancelled||(b.LastModified=b.LocalTimeStamp,this.fileLocations.push(b),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};b.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(b){b.cancel()})};b.prototype._sniffSearch=function(b){this._totalCounter++;
var c=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(b),this._statusService&&this._statusService.setProgressResult({Message:k.formatMessage(g["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return(c._progressService?c._progressService.progress(c.fileClient.read(b.Location),"Reading file "+b.Location):c.fileClient.read(b.Location)).then(function(d){c._hitOnceWithinFile(d)&&c._reportSingleHit(b);c._statusService&&c._statusService.setProgressResult({Message:k.formatMessage(g["${0} files found out of ${1}"],
c._hitCounter,c._totalCounter)},g.Cancel)},function(c){c&&c.message&&"cancel"!==c.message.toLowerCase()&&console.error("Error loading file content: "+c.message)})};b.prototype._buildSingleSkeleton=function(b){this._totalCounter++;this.fileSkeleton.push(b);this.searchHelper&&!this._buildSkeletonOnly&&0===this._totalCounter%100&&this.searchName();b=new h;b.resolve(this._totalCounter);return b};b.prototype.constructor=b;return{SearchCrawler:b}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages orion/crawler/searchCrawler orion/contentTypes require orion/webui/littlelib orion/util orion/webui/dialog".split(" "),function(g,l,k,e,d,h,b){function f(c){this._init(c)}f.prototype=new b.Dialog;f.prototype.TEMPLATE='\x3cdiv role\x3d"search"\x3e\x3cdiv\x3e\x3clabel id\x3d"fileNameMessage" for\x3d"fileName"\x3e${Type the name of a file to open (? \x3d any character, * \x3d any string):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"fileName" type\x3d"text" class\x3d"setting-control" style\x3d"width:90%;"/\x3e\x3c/div\x3e\x3cdiv id\x3d"progress" style\x3d"padding: 2px 0 0; width: 100%;"\x3e\x3cimg src\x3d"'+
e.toUrl("../../../images/progress_running.gif")+'" class\x3d"progressPane_running_dialog" id\x3d"crawlingProgress"\x3e\x3c/img\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:250px; height:auto; overflow-y:auto;" aria-live\x3d"off"\x3e\x3c/div\x3e\x3cdiv id\x3d"statusbar"\x3e\x3c/div\x3e\x3c/div\x3e';f.prototype._init=function(c){this.title=c.title||g["Find File Named"];this.modal=!0;this.messages=g;this._searcher=c.searcher;this._progress=c.progress;this._onHide=c.onHide;this._contentTypeService=
new k.ContentTypeRegistry(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=c.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=c.initialText;this._message=c.message;this._nameSearch=!0;void 0!==c.nameSearch&&(this._nameSearch=c.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(g["Missing required argument: fileService"]);
this._searchRenderer=c.searchRenderer;if(!this._searchRenderer||"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(g["Missing required argument: searchRenderer"]);this._initialize()};f.prototype._bindToDom=function(c){var b=this;b.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",g["FileName FolderName"]):this.$fileName.setAttribute("placeholder",g.Search);this.$fileName.addEventListener("input",function(a){b._time=+new Date;b._timeoutId&&
clearTimeout(b._timeoutId);b._timeoutId=setTimeout(b.checkSearch.bind(b),0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===d.KEY.ENTER){var c=d.$("a",b.$results);c&&(d.stop(a),(h.isMac?a.metaKey:a.ctrlKey)?window.open(c.href):(window.location.href=c.href,b.hide()))}},!1);c.addEventListener("keydown",function(a){var c,f,e;if(a.keyCode===d.KEY.DOWN||a.keyCode===d.KEY.UP)c=d.$$array("a",b.$results),f=document.activeElement,e=c.indexOf(f),a.keyCode===d.KEY.DOWN?0<=e?(f.classList.remove("treeIterationCursor"),
c=e<c.length-1?c[e+1]:c[0],c.focus(),c.classList.add("treeIterationCursor")):0<c.length&&(c=c[0],c.focus(),c.classList.add("treeIterationCursor")):0<=e?(f.classList.remove("treeIterationCursor"),f=b.$fileName,c=0<e?c[e-1]:f,c.focus(),0<e&&c.classList.add("treeIterationCursor")):0<c.length&&(c[c.length-1].focus(),c[c.length-1].classList.add("treeIterationCursor")),d.stop(a)});c.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(b._forceUseCrawler||!b._fileService.getService(b._searcher.getSearchLocation()).search){var a=
b._searchOnRoot?b._searcher.getSearchRootLocation():b._searcher.getChildrenLocation(),a=new l.SearchCrawler(b._searcher.registry,b._fileService,"",{searchOnName:!0,location:a});b._searcher.setCrawler(a);a.buildSkeleton(function(){b.$crawlingProgress.style.display="inline";b.$progress.appendChild(document.createTextNode(g["Building file skeleton..."]))},function(){b.$crawlingProgress.style.display="none";b.$progress.removeChild(b.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));this._initialText&&(this.$fileName.value=this._initialText,this.doSearch())};f.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var c=(new Date).getTime();c-this._time>this._searchDelay?(this._time=c,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};f.prototype._detectFolderKeyword=function(c){var b,a=c,d=null;if(this._nameSearch&&(b=/(\S+)\s*(.*)/,(c=b.exec(c))&&3===c.length))c[1]&&
(a=c[1]),c[2]&&(d=c[2]);return{keyword:a,folderKeyword:d}};f.prototype.doSearch=function(){var c=this.$fileName.value;if(c){var b=this._detectFolderKeyword(c),a=this._searcher.createSearchParams(b.keyword,this._nameSearch,this._searchOnRoot),f=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=f;var e=document.createElement("div");e.appendChild(document.createTextNode(this._nameSearch?g["Searching..."]:h.formatMessage(g["Searching for occurrences of"],
c)));d.empty(this.$results);this.$results.appendChild(e);this._searcher.search(a,b.folderKeyword,function(){f===this.currentSearch&&f.apply(null,arguments)}.bind(this))}};f.prototype.decorateResult=function(c){function b(c){0===c.button&&!c.ctrlKey&&!c.metaKey&&a.hide()}var a=this;c=d.$$array("a",c);for(var f=0;f<c.length;f++)c[f].addEventListener("click",b,!1)};f.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};f.prototype._afterHiding=function(){this._onHide&&this._onHide()};f.prototype.constructor=
f;return{OpenResourceDialog:f}});define("text!orion/banner/banner.html",[],function(){return'\x3cheader id\x3d"banner" role\x3d"banner"\x3e\n\t\x3c!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\x3e\n\n\t\x3cdiv id\x3d"staticBanner" class\x3d"layoutBlock topRowBanner"\x3e \x3c!-- primaryNav --\x3e\n\t\t\x3cdiv id\x3d"centralNavigationArea" style\x3d"position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"\x3e\x3c/div\x3e\n\n\t\t\x3c!-- Static "Home" link. TODO delete this --\x3e\n\t\t\x3ca id\x3d"home" class\x3d"layoutLeft "\x3e\x3c/a\x3e\n\n\t\t\x3c!-- Left banner component: hamburger --\x3e\n\t\t\x3cnav id\x3d"primaryNav" class\x3d"bannerLeftArea" style\x3d"z-index:2;" role\x3d"navigation"\x3e\n\t\t\t\t\x3cbutton class\x3d"centralNavigation commandSprite core-sprite-hamburger" type\x3d"button"id\x3d"centralNavigation"\x3e\x3c/button\x3e\n\t\t\x3c/nav\x3e\n\n\t\t\x3c!-- Middle banner component: Breadcrumb bar --\x3e\n\t\t\x3cdiv class\x3d"clear navigationBreadcrumb bannerMiddleArea" \x3e\n\t\t\t\x3cdiv id\x3d"location" class\x3d"currentLocation"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\n\t\t\x3c!-- Right banner component: user identity --\x3e\n\t\t\x3cdiv class\x3d"bannerRightArea" style\x3d"z-index:2;"\x3e\n\t\t\t\x3c!-- Global commands support. --\x3e\n\t\t\t\x3cdiv id\x3d"globalActions" class\x3d"spacingLeft layoutLeft"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- Search. TODO delete this --\x3e\n\t\t\t\x3cinput type\x3d"text" id\x3d"search" autocomplete\x3d"off" class\x3d"layoutLeft spacingLeft searchbox" role\x3d"search" style\x3d"display:none;"\x3e\n\t\t\t\x3cdiv id\x3d"searchOptions" class\x3d"layoutLeft" style\x3d"padding-top:1px;display:none;"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- User identity menu and Progress --\x3e\n\t\t\t\x3cdiv id\x3d"userMenu" class\x3d"spacingRight layoutRight" style\x3d"color:#ccc;line-height:16px;"\x3e\n\t\t\t\t\x3cdiv id\x3d"progressPane" class\x3d"progressWatch" tabindex\x3d"0" role\x3d"progressbar"\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchButton" class\x3d"watchButton"\x3e\x3c/div\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchBody" class\x3d"watchBody"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longMinute"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longHour"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\n\t\t\t\t\x3cdiv style\x3d"position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"\x3e\x3c/div\x3e\n\t\t\t\t\x3cspan id\x3d"userTrigger" tabindex\x3d"0" role\x3d"button" class\x3d"dropdownTrigger" style\x3d"z-index:2;"\x3e\n\t\t\t\t\x3c/span\x3e\n\t\t\t\t\x3cul id\x3d"userDropdown" class\x3d"dropdownMenu" role\x3d"menu"\x3e\x3c/ul\x3e\n\t\t\t\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e\n\n\t\x3c!-- IDE notification messages go in here --\x3e\n\t\x3cdiv id\x3d"notificationArea" class\x3d"notificationHide"\x3e\n\t\t\x3cdiv class\x3d"layoutLeft" id\x3d"notifications" aria-live\x3d"assertive" aria-atomic\x3d"true"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"layoutRight"\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" type\x3d"button" id\x3d"closeNotifications"\x3e\x3c/span\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/header\x3e'});
define("text!orion/banner/footer.html",[],function(){return'\x3c!--\n\x3cfooter id\x3d"footerContent" class\x3d"layoutBlock footerLayout" role\x3d"contentinfo"\x3e\n\t\x3cdiv class\x3d"logoFooter commandSprite core-sprite-orion-logo"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"footerBlock"\x3e${Orion is in Beta. Please try it out but BEWARE your data may be lost.}\x3c/div\x3e\n\t\x3cdiv class\x3d"footerRightBlock"\x3e\n\t\t\x3cul\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26version\x3d5.0" target\x3d"_blank"\x3e${Report a Bug}\x3c/a\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/privacy.php" target\x3d"_blank"\x3e${Privacy Policy}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/termsofuse.php" target\x3d"_blank"\x3e${Terms of Use}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/copyright.php" target\x3d"_blank"\x3e${Copyright Agent}\x3c/a\x3e\x3c/li\x3e\n\t\t\x3c/ul\x3e\n\t\x3c/div\x3e\n\x3c/footer\x3e\n--\x3e'});
define("text!orion/banner/toolbar.html",[],function(){return'\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"pageActions"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"selectionTools"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"navActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutLeft" style\x3d"padding-left:7px;padding-right:7px;margin-top:2px;" id\x3d"filterBox" style\x3d"visibility: hidden;"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"settingsActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutRight status" id\x3d"statusPane" role\x3d"status" aria-live\x3d"off"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"pageNavigationActions"\x3e\x3c/ul\x3e'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(g,l){function k(e,d,h){if(e=l.node(e))this._parent=e;else throw Error("Parent node of dropdown menu not found");this.options=h=h||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=h.selectionClass;e=document.createElement("div");e.classList.add("dropdownMenu");e.classList.add("dropdownMenuOpen");e.id=this.navDropDownId;e.style.display="none";this._parent.appendChild(e);this._dropdownMenu=
e;if(d=l.node(d))this._triggerNode=d;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");h.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(b){b.keyCode===l.KEY.ESCAPE&&this.clearPanel()}.bind(this))}g.mixin(k.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){l.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=l.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",l.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(e){this._dropdownMenu.innerHTML=e},getContentNode:function(){return this._dropdownMenu},updateContent:function(e,d){d()},_positionDropdown:function(){this._dropdownMenu.style.right="";var e=l.bounds(this._dropdownMenu),d=l.bounds(document.body);e.left+e.width>d.left+d.width&&(e=l.bounds(this._boundingNode(this._triggerNode)),d=l.bounds(this._triggerNode),this._dropdownMenu.style.right=e.width-(d.left-e.left+d.width)+"px")},_boundingNode:function(e){var d=window.getComputedStyle(e,
null);return null===d||"absolute"===d.getPropertyValue("position")||!e.parentNode||e===document.body?e:this._boundingNode(e.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return"none"!==this._dropdownMenu.style.display&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){this._parent&&(l.setFramesEnabled(!0),l.empty(this._parent),this._parent=this.select=null)}});return k});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"Import local file...":"File System","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}","Pasting ${0}":"Pasting ${0}",
"Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With",
"Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Copy a file from a URL and optionally unzip it":"Copy a file from a URL and optionally unzip it","Unzip *.zip files:":"Unzip *.zip files:","Extracted from:":"Extracted from:","Did not drop ${0}.  Folder drop is not supported in this browser.":"Did not drop ${0}.  Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace.  Create a folder first.":"You cannot copy files directly into the workspace.  Create a folder first.","Unzip ${0}?":"Unzip ${0}?",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(g,l,k){function e(b,d,c){if(!b[d])throw d+g[" is not supported in this file system"];return b[d].apply(b,c)}function d(b,f,c,m){if(!b.readBlob)throw g["source file service does not support binary read"];if(!c.writeBlob)throw g["target file service does not support binary write"];if("/"!==f[f.length-1])return e(b,"readBlob",[f]).then(function(a){return e(c,"writeBlob",[m,a])});var a=m.substring(0,
m.length-1),n=decodeURIComponent(a.substring(a.lastIndexOf("/")+1)),a=a.substring(0,a.lastIndexOf("/")+1);return e(c,"createFolder",[a,n]).then(function(){},function(){}).then(function(){return e(b,"fetchChildren",[f]).then(function(a){for(var f=[],e=0;e<a.length;++e){var n=a[e].Location,h=n;a[e].Directory&&(h=n.substring(0,n.length-1));h=decodeURIComponent(h.substring(h.lastIndexOf("/")+1));h=m+encodeURIComponent(h);a[e].Directory&&(h+="/");f[e]=d(b,n,c,h)}return l.all(f)})})}function h(b,d){function c(a){var c=
new l;c.reject(g["No Matching FileService for location:"]+a);return c}var e=b.getServiceReferences("orion.core.file"),a=e;if(d)for(var a=[],n=0;n<e.length;++n)d(e[n])&&a.push(e[n]);for(var h=[],s=[],t=[],y=[],u={fetchChildren:function(){var a=new l;a.resolve(y);return a},createWorkspace:function(){var a=new l;a.reject(g["no file service"]);return a},loadWorkspaces:function(){var a=new l;a.reject(g["no file service"]);return a},loadWorkspace:function(a){var c=new l;window.setTimeout(function(){c.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:g["File Servers"],Location:"/",Children:y,ChildrenLocation:"/"})},100);return c},search:c,createProject:c,createFolder:c,createFile:c,deleteFile:c,moveFile:c,copyFile:c,read:c,write:c},e=0;e<a.length;++e)y[e]={Directory:!0,Length:0,LocalTimeStamp:0,Location:a[e].getProperty("top"),ChildrenLocation:a[e].getProperty("top"),Name:a[e].getProperty("Name")},n=a[e].getProperty("pattern")||a[e].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==n[0]&&(n=
"^"+n),h[e]=RegExp(n),s[e]=b.getService(a[e]),t[e]=a[e].getProperty("Name"),a[e].getProperty("NameKey")&&a[e].getProperty("nls")&&k.getMessageBundle(a[e].getProperty("nls")).then(function(c,b){y[c].Name=b[a[c].getProperty("NameKey")];t[c]=b[a[c].getProperty("NameKey")]}.bind(this,e));this._getServiceIndex=function(a){if("/"===a)return-1;if(!a||a.length&&0===a.length)return s[0]?0:-1;for(var c=0;c<h.length;++c)if(h[c].test(a))return c;throw g["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return-1===a?u:s[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return-1===a?u.Name:t[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return-1===a?u.Location:y[a].Location}}h.prototype={getService:function(b){return this._getService(b)},fileServiceName:function(b){return this._getServiceName(b)},fileServiceRootURL:function(b){return this._getServiceRootURL(b)},fetchChildren:function(b){return e(this._getService(b),"fetchChildren",
arguments)},createWorkspace:function(b){return e(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return e(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(b){return e(this._getService(b),"loadWorkspace",arguments)},createProject:function(b,d,c,m){return e(this._getService(b),"createProject",arguments)},createFolder:function(b,d){return e(this._getService(b),"createFolder",arguments)},createFile:function(b,d){return e(this._getService(b),"createFile",
arguments)},deleteFile:function(b){return e(this._getService(b),"deleteFile",arguments)},moveFile:function(b,f,c){var m=this._getService(b),a=this._getService(f);if(m===a)return e(m,"moveFile",arguments);var n="/"===b[b.length-1],h=f;"/"!==h[h.length-1]&&(h+="/");if(c)h+=encodeURIComponent(c);else{var g=b;n&&(g=g.substring(0,g.length-1));h+=g.substring(g.lastIndexOf("/")+1)}n&&"/"!==h[h.length-1]&&(h+="/");return d(m,b,a,h).then(function(){return e(m,"deleteFile",[b])})},copyFile:function(b,f,c){var m=
this._getService(b),a=this._getService(f);if(m===a)return e(m,"copyFile",arguments);var n="/"===b[b.length-1],h=f;"/"!==h[h.length-1]&&(h+="/");if(c)h+=encodeURIComponent(c);else{var g=b;n&&(g=g.substring(0,g.length-1));h+=g.substring(g.lastIndexOf("/")+1)}n&&"/"!==h[h.length-1]&&(h+="/");return d(m,b,a,h)},read:function(b,d){return e(this._getService(b),"read",arguments)},readBlob:function(b){return e(this._getService(b),"readBlob",arguments)},write:function(b,d,c){return e(this._getService(b),"write",
arguments)},remoteImport:function(b,d){return e(this._getService(b),"remoteImport",arguments)},remoteExport:function(b,d){return e(this._getService(b),"remoteExport",arguments)},search:function(b){return e(this._getService(b.resource),"search",arguments)}};h.prototype.constructor=h;return{FileClient:h}});
define("orion/webui/SideMenu","orion/commands orion/objects orion/webui/littlelib orion/PageLinks orion/PageUtil orion/URITemplate orion/URL-shim orion/util".split(" "),function(g,l,k,e,d,h,b,f){function c(a,c){this.parentNode=k.node(a);this.contentNode=k.node(c);if(!this.parentNode)throw Error("Missing parentNode");this.menuitems=Object.create(null);this.categories=this.links=null;this.anchor=document.createElement("ul");this.anchor.classList.add("sideMenuList");this.parentNode.appendChild(this.anchor);
this.anchor.addEventListener("click",this._handleEvent.bind(this));this.anchor.addEventListener("touchstart",this._handleEvent.bind(this));this.anchor.addEventListener("focus",this._handleEvent.bind(this),!0);k.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function m(a){return!a.isRelatedLink}function a(a,c){var b=a.order,d=c.order;return b<d?-1:d<b?1:0}function n(a,c){var b=a.source.order,d=c.source.order,b="number"===typeof b?b:100,d="number"===typeof d?d:100;return b===d?a.textContent.localeCompare(c.textContent):
b<d?-1:1}var q=f.isTouch;l.mixin(c.prototype,{LOCAL_STORAGE_NAME:"sideMenuNavigation",OPEN_STATE:"open",CLOSED_STATE:"closed",DEFAULT_STATE:"open",SIDE_MENU_OPEN_WIDTH:"40px",TRANSITION_DURATION_MS:301,addMenuItem:function(a,c,b){var d=this.anchor;a=this.createListItem(a,c);b&&a.classList.add("sideMenuItemActive");d.appendChild(a);this.menuitems[c]=a},setSideMenu:function(){var a=this.getDisplayState(),c=this.parentNode;c&&(a===this.CLOSED_STATE&&(this.setPageContentLeft("0"),this._timeout&&(window.clearTimeout(this._timeout),
this._timeout=null),this._timeout=window.setTimeout(function(){c.style.display="none"},this.TRANSITION_DURATION_MS),c.classList.add("animating")),a===this.OPEN_STATE&&(this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),c.classList.remove("animating"),c.style.display="block",c.style.width=this.SIDE_MENU_OPEN_WIDTH,this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)))},setPageContentLeft:function(a){var c=this.contentNode;c&&(c.style.left=a)},toggleSideMenu:function(){var a=this.getDisplayState(),
c=this.contentNode;c&&c.classList.add("content-fixedHeight-animation");a=a===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;a===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,a);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];k.empty(this.anchor)},getMenuItems:function(){var a=this.menuitems;return Object.keys(a).map(function(c){return a[c]})},getMenuItem:function(a){return this.menuitems[a]},getDisplayState:function(){var a=
localStorage.getItem(this.LOCAL_STORAGE_NAME);a||(a=this.DEFAULT_STATE);return a},createListItem:function(a,c){var b=document.createElement("li");b.className=a;b.classList.add("sideMenuItem");b.categoryId=c;return b},setCategories:function(a){this.categories=a;this.links=Object.create(null)},setPageLinks:function(a){this.pageLinks=a;var c=this,b=a.createLinkElements();a.getAllLinks().forEach(function(a,d){var f=b[d];f.source=a;c._getLinksBin(a.category).push(f)});this._renderLinks()},setRelatedLinks:function(a,
c){this.relatedLinks=a;var b=this;Object.keys(this.links).forEach(function(a){var c=b._getLinksBin(a);b.links[a]=c.filter(m)});var d=document.createDocumentFragment();a.forEach(function(a){var c=a.relatedLink,f=b._getLinksBin(c.category);a=g.createCommandMenuItem(d,a.command,a.invocation);a.classList.remove("dropdownMenuItem");a.isRelatedLink=!0;a.source=c;f.push(a)});this._renderLinks(c)},_getLinksBin:function(a){if(a){var c=this.links;c[a]=c[a]||[];return c[a]}return[]},_sort:function(){var a=this.links;
Object.keys(a).forEach(function(c){a[c].sort(n)})},_renderCategories:function(){var c=this.categories,b=this,f=new URL(window.location.href),m=d.matchResourceParameters();m.OrionHome=e.getOrionHome();var n=!1;this.clearMenuItems();c.getCategoryIDs().map(function(a){return c.getCategory(a)}).sort(a).forEach(function(a){var c=b._getLinksBin(a.id);c.length&&(n?b.addMenuItem(a.imageClass,a.id,!1):(c=c.some(function(a){if(!a.source.uriTemplate)return!1;a=new h(a.source.uriTemplate);a=new URL(a.expand(m),
window.location);return a.protocol===f.protocol&&a.host===f.host&&a.hostname===f.hostname&&a.port===f.port&&a.pathname===f.pathname&&a.search===f.search?n=!0:!1}),b.addMenuItem(a.imageClass,a.id,c)))})},_renderLinks:function(a){a=a||[];this._sort();this._renderCategories();var c=this,b=window.location.href;Object.keys(this.menuitems).forEach(function(d){var f=c.getMenuItem(d);if(f){for(var e=c._getLinksBin(d).slice(),e=e.filter(function(c){var d=c.source;return 0<=a.indexOf(d.id)||!d.default&&!d.force&&
c.href===b?!1:!0}),e=e.filter(function(a){a=a.source;return!(1<e.length&&a.default&&!a.force)}),m=e.length-1;0<m;m--)e[m].href===e[m-1].href&&e.splice(m,1);if(e.length){f.appendChild(c._createCategoryElement(d,f,e[0]));var n=document.createElement("ul");n.className="sideMenuSubMenu";e.forEach(function(a){var c=document.createElement("li");c.className="sideMenuSubMenuItem";var b=document.createElement("a");b.href=a;b.className="sideMenuSubMenuItemLink";var d=document.createElement("span");d.innerHTML=
a.innerHTML;d.className="sideMenuSubMenuItemSpan";b.appendChild(d);c.appendChild(b);n.appendChild(c)});f.appendChild(n)}}})},_createCategoryElement:function(a,c,b){a=this.categories.getCategory(a);var d;q?(d=document.createElement("button"),d.type="button"):(d=document.createElement("a"),d.href=b.href);d.className+=a.imageClass;d.classList.add("submenu-trigger");d.tabIndex="0";c.classList.remove(a.imageClass);return d},_handleEvent:function(a){var c=a.target;a="focus"===a.type;if("A"!==c.tagName||
a)c.classList.contains("submenu-trigger")&&(q||a)&&this._expandMenu(k.$(".sideMenuSubMenu",c.parentNode))},_expandMenu:function(a){this.getMenuItems().forEach(function(c){c=k.$(".sideMenuSubMenu",c);a!==c&&c.classList.remove("expanded")});a&&a.classList.toggle("expanded")}});return c});
define("orion/globalCommands","i18n!orion/nls/messages require orion/commonHTMLFragments orion/keyBinding orion/EventTarget orion/commandRegistry orion/commands orion/parameterCollectors orion/extensionCommands orion/uiUtils orion/keyBinding orion/breadcrumbs orion/webui/littlelib orion/webui/splitter orion/webui/dropdown orion/webui/tooltip orion/contentTypes orion/URITemplate orion/keyAssist orion/PageUtil orion/widgets/themes/ThemePreferences orion/widgets/themes/container/ThemeData orion/Deferred orion/widgets/UserMenu orion/PageLinks orion/webui/dialogs/OpenResourceDialog text!orion/banner/banner.html text!orion/banner/footer.html text!orion/banner/toolbar.html orion/widgets/input/DropDownMenu orion/util orion/customGlobalCommands orion/fileClient orion/webui/SideMenu orion/objects".split(" "),function(g,
l,k,e,d,h,b,f,c,m,a,n,q,s,t,y,u,v,x,z,A,C,p,w,r,B,D,I,F,J,E,G,H,O,Q){function K(a,c){if(a.getLabel)return a.getLabel();var b=new p;b.resolve(c.properties.name);return b}function T(a){q.node("progressPane").setAttribute("aria-label",g["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function V(a,c){var b=a.getServiceReferences("orion.core.auth");ba=[];var d=U.createMenuGenerator.apply(this,arguments);if(d)for(var f=0;f<
b.length;f++){var p=b[f],e=a.getService(p);K(e,p).then(function(a){e.getKey().then(function(c){ba.push(c);e.getUser().then(function(b){d.addUserItem(c,e,a,b)},function(b,f){d.addUserItem(c,e,a,f)});window.addEventListener("storage",function(b){M[c]!==localStorage.getItem(c)&&(M[c]=localStorage.getItem(c),e.getUser().then(function(b){d.addUserItem(c,e,a,b)},function(b){d.addUserItem(c,e,a)}))},!1)})})}}function W(a){return a}function X(a,d,f,e,m){function r(){if(k)return k;var c=a.getService("orion.core.contentTypeRegistry");
c||(c=new u.ContentTypeRegistry(a),c=a.getService("orion.core.contentTypeRegistry"));return c.getContentTypes().then(function(a){return k=a})}function n(a){for(var c={},b=a.getPropertyKeys(),d,f=0;f<b.length;f++)d=b[f],c[d]=a.getProperty(d);return c}function w(a,c){var b=null;a.some(function(a){return c===a.getProperty("id")?!!(b=a):!1});return b}function h(a){var c=a.command;return!c.visibleWhen||c.visibleWhen(d)?(a.invocation=new b.CommandInvocation(d,d,null,c,e),(new p).resolve(a)):"function"===
typeof m?(B||(B=m()),p.when(B,function(f){if(f&&d===ca&&(!c.visibleWhen||c.visibleWhen(f)))return a.invocation=new b.CommandInvocation(f,f,null,c,e),a})):(new p).resolve()}function g(a,c,d){return d?(new p).resolve({relatedLink:a,command:d}):c.then(function(c){return{relatedLink:a,command:new b.Command(c)}})}var q=arguments,k,B,s=a&&a.getServiceReferences("orion.page.link.related");if(s&&0!==s.length){var D=this;p.when(r(),function(){if(U.beforeGenerateRelatedLinks.apply(D,q)){var b=a.getServiceReferences("orion.navigate.command"),
d=[];s.forEach(function(f){var p=n(f);if(p.id){var m;if((p.nls&&p.nameKey||p.name)&&p.uriTemplate)m=c._createCommandOptions(p,f,a,k,!0),d.push(g(p,m,null));else if(m=w(b,p.id)){var r=n(m);f={};Q.mixin(f,r,p);(p=e.findCommand(p.id))?d.push(g(f,null,p)):(m=c._createCommandOptions(r,m,a,k,!0),d.push(g(f,m,null)))}}});p.all(d,W).then(function(a){a.sort(function(a,c){return a.command.name.localeCompare(c.command.name)});return p.all(a.map(h),W).then(function(c){var b=[];c=c.filter(function(c,d){if(c)return!0;
b.push(a[d]);return!1});U.addRelatedLinkCommands.call(D,e,c,b,f);U.afterGenerateRelatedLinks.apply(D,q)})})}})}}function S(a){var c=q.node("globalActions");c&&(a.destroy(c),a.renderCommands(c.id,c,{},{},"tool"))}function $(a){var c=window.getComputedStyle(a,null);return null===c||"absolute"===c.getPropertyValue("position")||!a.parentNode||a===document.body?a:$(a.parentNode)}function P(a){var c={},b=null;"string"===typeof a&&(a=q.node(a));a||(a=q.node("pageActions"));for(var d=a;d&&d.classList;){if(d.classList.contains("toolComposite")){b=
d;break}d=d.parentNode}a.classList.contains("commandMarker")&&(c.commandNode=a);b&&(c.slideContainer=q.$(".slideParameters",b),c.parameterArea=q.$(".parameters",b),c.dismissArea=q.$(".parametersDismiss",b),c.notifications=q.$("#notificationArea",b),b.parentNode&&(c.toolbarTarget=q.$(".toolbarTarget",b.parentNode),c.toolbarTarget&&(a=q.bounds(c.toolbarTarget),d=q.bounds($(c.toolbarTarget.parentNode)),c.toolbarTargetY=a.top-d.top,c.toolbar=b)));return c}function L(a){if(a=a.slideContainer)if(a.style.left=
"",a.style.top="",a.classList.contains("slideContainerActive")){var c=q.bounds(a),b=q.bounds(a.parentNode);a.style.left=(b.width-c.width)/2+"px";a.style.top="0"}}h=function(a){var c=document.createElement("a");c.href=a;return c.href}(l.toUrl("auth/NotifyAuthentication.html"));var M={},N=null,U={createMenuGenerator:G.createMenuGenerator||function(a,c){if(q.node("userMenu")){var b=q.node("userDropdown"),d=new t.Dropdown({dropdown:b}),b=new w.UserMenu({dropdownNode:b,dropdown:d,serviceRegistry:a}),d=
q.node("userTrigger");new y.Tooltip({node:d,text:g.Options,position:["below","left"]});d=document.getElementById("userTrigger");d.className+=" imageSprite core-sprite-silhouette";b.setKeyAssist(c);return b}},beforeGenerateRelatedLinks:G.beforeGenerateRelatedLinks||function(a,c,b,d,f){return!0},addRelatedLinkCommands:G.addRelatedLinkCommands||function(a,c,b,d){this.sideMenu&&this.sideMenu.setRelatedLinks(c,d)},afterGenerateRelatedLinks:G.afterGenerateRelatedLinks||function(a,c,b,d,f){},afterSetPageTarget:G.afterSetPageTarget||
function(a){},generateNavigationMenu:G.generateNavigationMenu||function(a,c,b,d,f,p,e){if(a=q.node("sideMenu"))c=q.node("centralNavigation"),new y.Tooltip({node:c,text:g.CentralNavTooltip,position:["right"]}),N=this.sideMenu=new O(a,q.node("pageContent")),c.addEventListener("click",N.toggleSideMenu.bind(N)),(a=q.node("sideMenuToggle"))&&a.addEventListener("click",N.toggleSideMenu.bind(N))},afterGenerateNavigationMenu:G.afterGenerateNavigationMenu||function(a,c,b,d,f,p,e){},afterGenerateBanner:G.afterGenerateBanner||
function(a,c,b,d,f,p,e){}},ba=[],ca,aa=[],R,Z=null,Y=null,da=new d;return{generateBanner:function(a,c,d,m,n,w,h,t){function y(a){a.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";for(var c=q.$$array(".targetSelector"),b=0;b<c.length;b++)c[b].target=a}},{pid:"nav.config"})}(new A.ThemePreferences(m,new C.ThemeData)).apply();var u=q.node(a);if(!u)throw g["could not find banner parent, id was "]+a;var H=document.createRange();
H.selectNode(u);H=H.createContextualFragment(D);q.processTextNodes(H,g);u.firstChild?u.insertBefore(H,u.firstChild):u.appendChild(H);u=q.node("home");u.href=l.toUrl("edit/edit.html");u.setAttribute("aria-label",g["Orion Home"]);q.node("progressPane").src=b.NO_IMAGE;if(u=q.node("pageToolbar"))u.classList.add("toolbarLayout"),u.innerHTML=F+k.slideoutHTMLFragment("mainToolbar");(u=q.node("closeNotifications"))&&u.setAttribute("aria-label",g["Close notification"]);if(17>=E.isFirefox&&(u=q.node("staticBanner")))u.style.width=
"100%",u.style.MozBoxSizing="border-box";if(u=q.node("footer"))u.innerHTML=I,q.processTextNodes(u,g);d.setParameterCollector(new f.CommandParameterCollector(P,L));document.addEventListener("keydown",function(a){a.keyCode===q.KEY.ESCAPE&&(a=c.getService("orion.page.message"))&&a.setProgressMessage("")},!1);U.generateNavigationMenu.apply(this,arguments);U.afterGenerateNavigationMenu.apply(this,arguments);u=r.getCategoriesInfo(c);H=r.getPageLinksInfo(c,"orion.page.link");p.all([u,H]).then(function(a){if(N){var c=
a[1];N.setCategories(a[0]);N.setPageLinks(c);N.setSideMenu()}});if(u=q.$(".split")){var H=q.$(".sidePanelLayout"),v=q.$(".mainPanelLayout");H&&v&&(Z={side:H,main:v},Z.splitter=new s.Splitter({node:u,sidePanel:H,mainPanel:v,toggle:!0,closeByDefault:t}),u=new b.Command({name:g["Toggle side panel"],tooltip:g["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){Z.splitter.toggleSidePanel()}}),d.addCommand(u),d.registerCommandContribution("pageActions","orion.toggleSidePane",1,
null,!0,new e.KeyBinding("l",E.isMac?!1:!0,!0,!1,E.isMac?!0:!1)))}var J=!1,G=function(a,c){if(!J){var b=c.getService("orion.page.progress"),d=new B.OpenResourceDialog({searcher:a,progress:b,searchRenderer:a.defaultRenderer,onHide:function(){J=!1}});window.setTimeout(function(){J=!0;d.show()},0)}},u=new b.Command({name:g["Find File Named..."],tooltip:g["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(a){G(n,c)}});d.addCommand(u);d.registerCommandContribution("globalActions",
"orion.openResource",100,null,!0,new e.KeyBinding("f",!0,!0));u=new b.Command({name:g["Toggle banner and footer"],tooltip:g["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var a=q.node("banner"),c=q.node("footer"),b=q.node("sideMenu"),d=q.$(".content-fixedHeight"),f="hidden"===a.style.visibility;f?(a.style.visibility="visible",c.style.visibility="visible",d.classList.remove("content-fixedHeight-maximized"),b&&b.classList.remove("sideMenu-maximized")):(a.style.visibility=
"hidden",c.style.visibility="hidden",d.classList.add("content-fixedHeight-maximized"),b&&b.classList.add("sideMenu-maximized"));da.dispatchEvent({type:"toggleTrim",maximized:!f});return!0}});d.addCommand(u);d.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new e.KeyBinding("m",!0,!0));u=new b.Command({name:g["System Configuration Details"],tooltip:g["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return l.toUrl("help/about.html")}});d.addCommand(u);
d.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new e.KeyBinding(112,!0,!0));u=new b.Command({name:g["Background Operations"],tooltip:g["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return l.toUrl("operations/list.html")}});d.addCommand(u);d.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new e.KeyBinding("o",!0,!0));Y=new x.KeyAssistPanel({commandRegistry:d});u=new b.Command({name:g["Show Keys"],
tooltip:g["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){Y.isVisible()?Y.hide():Y.show();return!0}});d.addCommand(u);d.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new e.KeyBinding(191,!1,!0));S(d);V(c,u.callback);T(c);window.addEventListener("hashchange",function(){d.processURL(window.location.href)},!1);window.setTimeout(function(){y(c)},0);U.afterGenerateBanner.apply(this,arguments)},getToolbarElements:P,getMainSplitter:function(){return Z},
getKeyAssist:function(){return Y},getGlobalEventTarget:function(){return da},layoutToolbarElements:L,setPageTarget:function(a){var c,b,d=a.breadcrumbRootName,f=a.serviceRegistry;a.target?(a.searchService&&a.searchService.setLocationByMetaData(a.target),a.fileService&&!a.breadcrumbTarget&&!a.staticBreadcrumb&&(b=(d?d+" ":"")+a.fileService.fileServiceName(a.target.Location),d=null),c=a.name||a.target.Name,ca=a.target,X.call(this,f,a.target,aa,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||
(d=d||a.task||a.name),c=a.name,X.call(this,f,{NoTarget:""},aa,a.commandService,a.makeAlternate));(R=a.title)||(R=c?c+" - "+a.task:a.task);window.document.title=R;U.afterSetPageTarget.apply(this,arguments);if(c=a.breadCrumbContainer?q.node(a.breadCrumbContainer):q.node("location"))if(q.empty(c),a.staticBreadcrumb)new n.BreadCrumbs({container:c,rootSegmentName:d});else{var p=f&&new H.FileClient(f),f=a.breadcrumbTarget||a.target,p=p&&f&&f.Location?p.fileServiceRootURL(f.Location):null;new n.BreadCrumbs({container:c,
resource:f,rootSegmentName:d,workspaceRootSegmentName:b,workspaceRootURL:p,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){R&&("*"===R.charAt(0)&&!a&&(R=R.substring(1)),a&&"*"!==R.charAt(0)&&(R="*"+R),window.document.title=R);var c=q.node("dirty");c&&(c.textContent=a?"*":"")},setPageCommandExclusions:function(a){aa=a},notifyAuthenticationSite:h}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(g){return{detectValidURL:function(l){for(var k=/\[([^\]]*)\]\(([^\)]+)\)/g,e=k.exec(l),d=[],h=0;e;){if(3===e.length&&0<e[2].length){var b=new URL(e[2]);":"!==b.protocol&&g.validateURLScheme(b.href)&&(e.index>h&&d.push({segmentStr:l.substring(h,e.index)}),d.push({segmentStr:0<e[1].length?e[1]:e[2],urlStr:e[2]}),h=e.index+e[0].length)}e=k.exec(l)}if(0===h)return null;h<l.length-1&&d.push({segmentStr:l.substring(h)});return d},processURLSegments:function(g,
k){k.forEach(function(e){if(e.urlStr){var d=document.createElement("a");d.href=e.urlStr;d.appendChild(document.createTextNode(e.segmentStr))}else d=document.createElement("span"),d.textContent=e.segmentStr;g.appendChild(d)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(g,l,k,e){function d(b,d,c,e,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.message",this);this._operationsClient=d;this.notificationContainerDomId=a;this.domId=c;this.progressDomId=e||c;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var h;d.prototype={_init:function(){var b=l.node("closeNotifications");if(b&&
!this._hookedClose){b.style.cursor="pointer";this._hookedClose=!0;var d=l.node(this.notificationContainerDomId);l.addAutoDismiss([d],function(){this._clickToDisMiss&&this.close()}.bind(this));b.addEventListener("click",function(){this.close()}.bind(this));d.addEventListener("click",function(c){c&&c.target&&"a"===c.target.nodeName.toLowerCase()&&(c=l.$$("a",d))&&c.length&&1===c.length&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var b=l.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&b?(b.innerHTML="",b.classList.remove("cancelButton"),b.classList.add("dismissButton"),b.classList.add("core-sprite-close"),b.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){this._notifierElements||(this._notifierElements=k.getToolbarElements(this.notificationContainerDomId));return this._notifierElements},setMessage:function(b,d,c){this._init();this.currentMessage=b;var e=l.node(this.domId);
if("boolean"===typeof c){var a=e.getAttribute("aria-live");e.setAttribute("aria-live",c?"polite":"off");window.setTimeout(function(){b===this.currentMessage&&(l.empty(e),e.appendChild(document.createTextNode(b)),window.setTimeout(function(){e.setAttribute("aria-live",a)},100))}.bind(this),100)}else l.empty(e),e.appendChild(document.createTextNode(b));"number"===typeof d&&window.setTimeout(function(){b===this.currentMessage&&(l.empty(e),e.appendChild(document.createTextNode("")))}.bind(this),d)},setErrorMessage:function(b){this._clickToDisMiss=
!0;this.currentMessage=b;this._init();var d=b.responseText||b.message||b;if("string"===typeof d)try{d=JSON.parse(d)}catch(c){}b=d.Message||d;var e="red";if(d.Severity)switch(d.Severity){case "Warning":e="#FFCC00";break;case "Error":e="red";break;case "Info":case "Ok":e="green"}d=document.createElement("span");d.style.color=e;d.appendChild(document.createTextNode(b));b=l.node(this.domId);l.empty(b);b.appendChild(d)},setProgressMessage:function(b){this._clickToDisMiss=!1;this._init();this.currentMessage=
b;var d=document.createElement("span");d.classList.add("progressIcon");var c=l.node(this.progressDomId);l.empty(c);c.appendChild(d);c.appendChild(document.createTextNode(b));d=l.node(this.notificationContainerDomId);d.classList.remove("notificationHide");if(b&&0<b.length)d.classList.add("progressNormal"),d.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();d.classList.remove("notificationShow");d.classList.add("notificationHide")}},
setCancelFunction:function(b){this._cancelFunc=b},setProgressResult:function(b,d){this._clickToDisMiss=!1;this._cancelMsg=d;this.currentMessage=b;var c=b.responseText||b;if("string"===typeof c)try{c=JSON.parse(c)}catch(m){}this._init();var a=c.Message||c.toString(),n=g.UnknownError,h="core-sprite-information",k="progressNormal",t=document.createElement("span");t.classList.add("imageSprite");t.classList.add("progressIcon");var y=[];if(c.Severity)switch(c.Severity){case "Warning":n=g.UnknownWarning;
h="core-sprite-warning";k="progressWarning";y.push("progressInfo");y.push("progressError");y.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":h="core-sprite-error";k="progressError";y.push("progressWarning");y.push("progressInfo");y.push("progressNormal");this._clickToDisMiss=!0;break;default:k="progressNormal",y.push("progressWarning"),y.push("progressError"),y.push("progressNormal")}y.push("notificationHide");t.classList.add(h);var u=l.node(this.progressDomId),h=l.node(this.notificationContainerDomId);
l.empty(u);u.appendChild(t);a===Object.prototype.toString()&&(a=n);c.HTML?(c=document.createElement("span"),c.innerHTML=a,u.appendChild(c)):((n=e.detectValidURL(a))?(a=document.createDocumentFragment(),e.processURLSegments(a,n),Array.prototype.forEach.call(l.$$("a",a),function(a){a.target="_blank"})):("Warning"!==c.Severity&&"Error"!==c.Severity&&!d&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
a=document.createTextNode(a)),u.appendChild(a));if(k&&this.progressDomId!==this.domId){h.classList.add(k);for(k=0;k<y.length;k++)h.classList.remove(y[k])}h.classList.add("notificationShow");if(y=l.node("closeNotifications"))this._cancelMsg?(y.classList.add("cancelButton"),y.classList.remove("dismissButton"),y.classList.remove("core-sprite-close"),y.classList.remove("imageSprite"),y.innerHTML=this._cancelMsg):(y.innerHTML="",y.classList.remove("cancelButton"),y.classList.add("dismissButton"),y.classList.add("core-sprite-close"),
y.classList.add("imageSprite"))},showWhile:function(b,d){var c=this;if(d){c.setProgressMessage(d);var e=function(){d===c.currentMessage&&c.setProgressMessage("")};b.then(e,e)}return b},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(b,d){return new h(this,++this._lastProgressId,b,d)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var b="",d=!0,c;for(c in this._progressMonitors)this._progressMonitors[c].status&&(d||(b+=", "),b+=this._progressMonitors[c].status,
d=!1);this.setProgressMessage(b)}else this.setProgressMessage("")},_beginProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._renderOngoingMonitors()},_doneProgressMonitor:function(b){delete this._progressMonitors[b.progressId];this._progressMonitors.length--;b.status?this.setProgressResult(b.status):this._renderOngoingMonitors()}};d.prototype.constructor=
d;h=function(b,d,c,e){this.statusService=b;this.progressId=d;if(c){this.deferred=c;this.begin(e);var a=this;c.then(function(c,b){a.done.bind(a)()},function(c,b){a.done.bind(a)()})}};h.prototype.begin=function(b){this.status=b;this.statusService._beginProgressMonitor(this)};h.prototype.done=function(b){this.status=b;this.statusService._doneProgressMonitor(this)};h.prototype.worked=function(b){this.status=b;this.statusService._workedProgressMonitor(this)};h.prototype.constructor=h;return{StatusReportingService:d,
ProgressMonitor:h}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(g,l,k,e){function d(){}d.prototype={_initialize:function(d,b,f,c,m){this._tooltip=new e.Tooltip({node:d,hideDelay:m||0,afterShowing:this._afterShowingFunction(b).bind(this),afterHiding:f,trigger:c?c:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";d=document.createRange();d.selectNode(this.$parent);d=d.createContextualFragment(this.TEMPLATE);
this.messages&&k.processTextNodes(d,g);this.$parent.appendChild(d);var a=this._tooltip;this.$parent.addEventListener("keydown",function(c){c.keyCode===k.KEY.ESCAPE&&a.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(d){for(var b=0;b<d.childNodes.length;b++){var f=d.childNodes[b];f.id&&(this["$"+f.id]=f);this._bindElements(f)}},_afterShowingFunction:function(d){return function(){d&&d.bind(this)();if(!this.customFocus){var b=
k.firstTabbable(this.$parent);b&&b.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};d.prototype.constructor=d;return{PopupDialog:d}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(g,l,k,e){var d={};(function(){var h=!1;d.updateNavTools=function(b,d,c,e,a,n){var q=k.node(e);if(q)d.destroy(q);else throw g["could not find toolbar "]+e;d.renderCommands(e,q,n,c,"button");if(a&&(e=k.node(a)))d.destroy(e),d.renderCommands(a,e,null,c,"button");h||(h=!0,b.getService("orion.page.selection").addEventListener("selectionChanged",function(b){var e=k.node(a);
e&&(d.destroy(e),d.renderCommands(a,e,b.selections,c,"button"))}))};d.createOperationsCommands=function(b,d,c){function m(a){return!a.operation||!a.operation.type?!1:"loadstart"===a.operation.type||"progress"===a.operation.type}var a=new e.Command({name:g["Remove Completed"],tooltip:g["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(a){c.removeCompletedOperations().then(function(a){d.loadOperations.bind(d)()})},visibleWhen:function(a){return!0}});b.addCommand(a);
a=new e.Command({name:g.Remove,tooltip:g["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var e=a[b];c.removeOperation.bind(c)(e.Location).then(function(){d.loadOperations.bind(d)()},function(){d.loadOperations.bind(d)()})}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return!m(a);for(var c in a)if(m(a[c]))return!1;return!0}});b.addCommand(a);
a=new e.Command({name:g.Cancel,tooltip:g["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var c=0;c<a.length;c++){var b=a[c];b.deferred&&b.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return m(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var c in a)if(!m(a[c])||!a[c].operation||!a[c].operation.cancelable)return!1;return!0}});b.addCommand(a)}})();
return d});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(g,l,k,e,d){function h(b){this._options=b}h.prototype=new e.PopupDialog;h.prototype.TEMPLATE='\x3ctable style\x3d"width: 360px;"\x3e\x3ctr\x3e\x3ctd\x3e\x3ch2\x3eRecent operations\x3c/h2\x3e\x3c/td\x3e\x3ctd style\x3d"text-align: right;"\x3e\x3ca id\x3d"allOperationsLink" class\x3d"navlinkonpage"\x3eAll Operations\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cdiv id\x3d"operationsExist"\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"myOperationsListEmpty"\x3eNo operations running on this page.\x3c/div\x3e\x3ctable id\x3d"myOperationsList" style\x3d"display: none;"\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"operationsDontExist"\x3eNo operations running.\x3c/div\x3e';h.prototype._init=
function(b){this._myOperations=[];this._operationsDeferreds=[];this._commandService=b.commandRegistry;d.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(b.triggerNode)};h.prototype._bindToDom=function(b){this.$allOperationsLink.href=l.toUrl("operations/list.html");this._setOperationsVisibility()};h.prototype.setOperations=function(b,d){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(b)for(var c in b)this._myOperations.push(b[c]),this._operationsDeferreds.push(d[c]);this._renderOperations()};h.prototype.parseProgressResult=function(b){if(!b)return{};b=b.responseText||b;try{b=JSON.parse(b)}catch(d){}var c={Message:b.Message||b,Severity:b.Severity};b.DetailedMessage&&b.DetailedMessage!==c.Message&&(c.DetailedMessage=b.DetailedMessage);return c};h.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};h.prototype._renderOperationsTable=function(b,d,c){k.empty(b);for(var e=0;e<d.length;e++){var a=d[e],n=document.createElement("tr"),h=document.createElement("td");h.style.paddingLeft="5px";h.style.paddingRight="5px";h.textContent=a.Name;n.appendChild(h);var s=document.createElement("div");h.appendChild(s);h=document.createElement("span");h.style.paddingRight="5px";h.classList.add("imageSprite");switch(a.type){case "Warning":h.classList.add("core-sprite-warning");
h.setAttribute("aria-label",g["Operation resulted in a warning."]);break;case "error":h.classList.add("core-sprite-error");h.setAttribute("aria-label",g["Operation resulted in an error."]);break;case "loadstart":case "progress":h.classList.add("core-sprite-start");h.setAttribute("aria-label",g["Operation is running."]);break;case "abort":h.classList.add("core-sprite-stop");h.setAttribute("aria-label",g["Operation is canceled."]);break;case "load":case "loadend":h.classList.add("core-sprite-ok"),h.setAttribute("aria-label",
"Operation ok.")}s.appendChild(h);h=document.createElement("span");h.classList.add("operationStatus");h.textContent=a.Name;s.appendChild(h);if(a.error){var t=a.error.Message||a.error;a.error.DetailedMessage&&""!==a.error.DetailedMessage&&(t+=": "+a.error.DetailedMessage);h.textContent=t;h.classList.remove("operationStatus");h.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",s,{operation:a,deferred:c[e]},this,"tool");b.appendChild(n)}this._setOperationsVisibility()};
h.prototype._setOperationsVisibility=function(){this.$myOperationsList.style.display=0<this._myOperations.length?"":"none";this.$myOperationsListEmpty.style.display=0<this._myOperations.length?"none":"";this.$operationsDontExist.style.display=0<this._myOperations.length?"none":"";this.$operationsExist.style.display=0<this._myOperations.length?"":"none"};h.prototype.constructor=h;return{OperationsDialog:h}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(g,l,k,e,d){function h(b,c){if(!this._progressPane){this._progressPane=e.node(b);this._operationsDialog=new d.OperationsDialog({triggerNode:this._progressPane,commandRegistry:c});var m=this;this._progressPane.addEventListener("keydown",function(a){(" "===a.charOrCode||a.keyCode===e.KEY.ENTER)&&m._operationsDialog.show()});this._progressPane.addEventListener("click",
function(a){m._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function b(b,c,d,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._commandRegistry=d;this._operationsClient=c;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}h.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,c){var d={},a;for(a in b)b[a].progressMonitor||(d[a]=b[a]);if(this._isEmpty(d))this._switchIconTo("progressPane_empty"),this._progressPane.title=g.Operations,this._progressPane.alt=g.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var e="";for(a in d){var h=d[a];if(h.type&&("loadstart"===h.type||"progress"===h.type)){e=
"running";break}}""===e&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==e;switch(e){case "running":this._progressPane.title=g["Operations running"];this._progressPane.alt=g["Operations running"];this._progressPane.setAttribute("aria-valuetext",g["Operations running"]);this._switchIconTo("running");break;case "warning":this._progressPane.title=g["Some operations finished with warning"];this._progressPane.alt=g["Some operations finished with warning"];
this._progressPane.setAttribute("aria-valuetext",g["Some operations finished with warning"]);this._switchIconTo("warning");break;case "error":this._progressPane.title=g["Some operations finished with error"];this._progressPane.alt=g["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",g["Some operations finished with error"]);this._switchIconTo("error");break;default:this._progressPane.title=g.Operations,this._progressPane.alt=g.Operations,this._progressPane.hasAttribute("aria-valuetext")&&
this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_empty")}}this._operationsDialog.setOperations(d,c)},_isEmpty:function(b){for(var c in b)return!1;return!0}};h.prototype.constructor=h;b.prototype={init:function(b){this._progressMonitorClass||(this._progressMonitorTool=new h(b,this._commandRegistry))},progress:function(b,c,d){var a=this,e=this._operationsIndex++;!d&&this._progressMonitorClass&&(d=new this._progressMonitorClass,d.begin(c));b.then(function(h){a._operations[e]&&
(h=a._operations[e],c&&(h.Name=c),a._lastOperation=h,h.type="loadend",d&&(h.progressMonitor=d),a.writeOperation.bind(a)(e,h,b),h.Location||a._removeOperationFromTheList.bind(a)(e))},function(h){if(a._operations[e]){var g=a._operations[e];c&&(g.Name=c);d&&(g.progressMonitor=d);a._lastOperation=g;g.type=h.canceled?"abort":"error";g.error=h;a.writeOperation.bind(a)(e,g,b);g.Location||a._removeOperationFromTheList.bind(a)(e)}},function(h){c&&(h.Name=c);d&&(h.progressMonitor=d);a.writeOperation.bind(a)(e,
h,b)});return b},removeOperation:function(b){for(var c in this._operations)if(this._operations[c].Location&&this._operations[c].Location===b){this._removeOperationFromTheList(c);break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},_removeOperationFromTheList:function(b){var c=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];c?c.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var b in this._operations){var c=this._operations[b];c.type&&"loadstart"!==c.type&&"progress"!==c.type&&((c=this._operations[b].progressMonitor)&&c.done(),delete this._operations[b],delete this._operationDeferrds[b])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(b){this._serviceRegistry.getService("orion.page.message").setProgressResult(b)},showWhile:function(b,c,d){c&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(c);
var a=this;b.then(function(c){a._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(c){d?a._serviceRegistry.getService("orion.page.message").setProgressMessage(""):a.setProgressResult.bind(a)(c);return c});return this.progress(b,c)},writeOperation:function(b,c,d){this._operations[b]=c;this._operationDeferrds[b]=d;c.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(c.Location,{Name:c.Name,expires:c.expires})});
c.progressMonitor?c.progressMonitor.progress(c.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};b.prototype.constructor=b;return{ProgressService:b}});define("orion/dialogs",[],function(){function g(g){this._serviceRegistry=g;this._serviceRegistration=g.registerService("orion.page.dialog",this)}g.prototype={confirm:function(g,k){k(window.confirm(g))},openFiles:function(g){}};g.prototype.constructor=g;return{DialogService:g}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(g,l){function k(e,d){d||(d="orion.page.selection");this._serviceRegistry=e;g.attach(this);this._serviceRegistration=e.registerService(d,this);this._selections=null}k.prototype={getSelection:function(e){var d=this._getSingleSelection();"function"===typeof e&&e(d);return d},getSelections:function(e){var d=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof e&&e(d);return d},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(e){var d=this._selections;Array.isArray(e)?this._selections=0<e.length?e.slice():null:this._selections=e?[e]:null;d!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(g,l){function k(b,d,c){return b[d].apply(b,c)}function e(b){this._location=b}function d(){var b=new l;b.reject(g["No Matching OperationService for location:"]+this._location);return b}function h(b){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=b.getService("orion.core.preference");for(var d=b.getServiceReferences("orion.core.operation"),
c=0;c<d.length;c++){var m=b.getService(d[c]);this._services[c]=m;m=d[c].getProperty("pattern")||".*";"^"!==m[0]&&(m="^"+m);this._patterns[c]=RegExp(m)}this._getService=function(a){if(!a)return this._services[0];for(var c=0;c<this._patterns.length;++c)if(this._patterns[c].test(a))return this._services[c];this._operations.remove(a);return new e(a)}}e.prototype={getOperation:d,getOperations:d,removeCompletedOperations:d,removeOperation:d,cancelOperation:d};e.prototype.constructor=e;h.prototype={getOperations:function(){var b=
new l;if(this._operations)return b.resolve(this._operations),b;var d=this;this._preferenceService.getPreferences("/operations").then(function(c){d._operations=c;b.resolve(d._operations)});return b},getOperation:function(b){return k(this._getService(b),"getOperation",arguments)},removeCompletedOperations:function(){for(var b=[],d=this,c=0;c<this._services.length;c++){var e=this._patterns[c],a=new l;b[c]=a.promise;k(this._services[c],"removeCompletedOperations").then(function(a){return function(c){Array.isArray(c)&&
d.getOperations.bind(d)().then(function(b){for(var d=b.keys(),f=0;f<d.length;f++){var h=d[f];e.test(h)&&0>c.indexOf(h)&&b.remove(h)}a.resolve()})}}(a),function(a){return function(c){a.reject(c)}}(a))}return l.all(b)},removeOperation:function(b){var d=this;return k(this._getService(b),"removeOperation",arguments).then(function(c){d.getOperations.bind(d)().then(function(c){c.remove(b)})},function(c){return c},function(c){return c})}};h.prototype.constructor=h;return{OperationsClient:h}});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace All":"Replace All",
"Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}","Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",
Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches","Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes",
"Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","\x3c Previous Page":"\x3c Previous Page","Show previous page of search result":"Show previous page of search result","Next Page \x3e":"Next Page \x3e","Show next page of search result":"Show next page of search result","Next result":"Next result","Previous result":"Previous result","Expand all results":"Expand all results",
"Collapse all results":"Collapse all results","Writing files...":"Writing files...","Preparing preview...":"Preparing preview...","Replaced File (${0})":"Replaced File (${0})","Original File (${0})":"Original File (${0})","Sort by Name":"Sort by Name","Compare changes":"Compare changes","Search Results":"Search Results","Replace All Matches":"Replace All Matches","No matches":"No matches",Rename:"Rename","My Saved Searches":"My Saved Searches","Save frequently used searches by choosing ${0} shown above.":"Save frequently used searches by choosing ${0} shown above.",
"Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.","Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","Sort by":"Sort by","File name":"File name","Path name":"Path name",
Save:"Save","Type a name for the search":"Type a name for the search","Save the current search":"Save the current search","Type filter text":"Type filter text","Scope Search":"Scope Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.","Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",root:"root",Scope:"Scope"});
define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(g,l){function k(e){this._init(e)}k.prototype={_init:function(e){var d=e.parent,h=this,d=l.node(d);if(!d)throw g["no parent"];if(!e.model)throw g["no tree model"];if(!e.renderer)throw g["no renderer"];this._parent=d;this._treeModel=e.model;this._onComplete=e.onComplete;this._renderer=e.renderer;this._showRoot=void 0===e.showRoot?!1:e.showRoot;this._indent=void 0===e.indent?16:e.indent;this._onCollapse=e.onCollapse;
this._labelColumnIndex=void 0===e.labelColumnIndex?0:e.labelColumnIndex;this._id=void 0===e.id?"treetable":e.id;this._tableStyle=e.tableStyle;this._tableElement=e.tableElement||"table";this._tableBodyElement=e.tableBodyElement||"tbody";this._tableRowElement=e.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(b){h._showRoot?(b._depth=0,h._generate([b],0)):h._treeModel.getChildren(b,function(b){h.destroyed||h._generate(b,0)})})},destroy:function(){this.destroyed=!0},_generate:function(e,
d){l.empty(this._parent);var h=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(h);var b=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(b);b.id=this._id;this._tableStyle&&b.classList.add(this._tableStyle);this._renderer.initTable(b,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===e.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(e,d);b.appendChild(this._bodyElement);h.appendChild(b);this._parent.appendChild(h);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(e,d,h){for(var b=0;b<e.length;b++){var f=document.createElement(this._tableRowElement);f.id=this._treeModel.getId(e[b]);f._depth=d;f._item=e[b];this._renderer.render(e[b],f);f.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*d+"px";this._renderer.rowCallback&&this._renderer.rowCallback(f,e[b]);h?(this._bodyElement.insertBefore(f,h.nextSibling),h&&(h=f)):this._bodyElement.appendChild(f)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(e,d,h){var b=this._treeModel.getId(e),f;if(b===this._id)this._removeChildRows(b),this._generateChildren(d,0),this._rowsChanged();else{var c=l.node(b);c?(c._item=e,
c&&(h||c._expanded)?(this._removeChildRows(b),d?(c._expanded=!0,this._renderer.updateExpandVisuals(c,!0),this._generateChildren(d,c._depth+1,c),this._rowsChanged()):(f=this,this._renderer.updateExpandVisuals(c,"progress"),d=this._treeModel.getChildren(c._item,function(b){f.destroyed||(f._renderer.updateExpandVisuals(c,!0),c._expanded||(c._expanded=!0,f._generateChildren(b,c._depth+1,c),f._rowsChanged()))}))):this._renderer.updateExpandVisuals(c,!1)):console.log(g["could not find table row "]+b)}},
getItem:function(e){var d=l.node(e);return d&&d._item?d._item:e},toggle:function(e){var d=l.node(e);d&&(d._expanded?this.collapse(e):this.expand(e))},isExpanded:function(e){e="string"===typeof e?e:this._treeModel.getId(e);return(e=l.node(e))?e._expanded:!1},expand:function(e,d,h){e="string"===typeof e?e:this._treeModel.getId(e);var b=l.node(e);if(b){var f=this;b._expanded?d&&d.apply(f,h):(this._renderer.updateExpandVisuals(b,"progress"),this._treeModel.getChildren(b._item,function(c){f.destroyed||
(f._renderer.updateExpandVisuals(b,!0),b._expanded||(b._expanded=!0,f._generateChildren(c,b._depth+1,b),f._rowsChanged()),d&&d.apply(f,h))}))}},_removeChildRows:function(e){for(var d=e===this._id,h=!1,b=-1,f=[],c=l.$$array(".treeTableRow",this._parent),m=0;m<c.length;m++){var a=c[m];if(h)break;d?a._depth>b?f.push(a):h=!0:a.id===e&&(d=!0,b=a._depth)}for(e=0;e<f.length;e++)d=f[e],d.parentNode.removeChild(d)},collapse:function(e){e="string"===typeof e?e:this._treeModel.getId(e);var d=l.node(e);if(d){if(!d._expanded)return;
d._expanded=!1;this._renderer.updateExpandVisuals(d,!1);this._removeChildRows(e);this._rowsChanged()}this._onCollapse&&this._onCollapse(d._item)},getIndent:function(){return this._indent}};k.prototype.constructor=k;return{TableTree:k}});
define("orion/treeModelIterator",[],function(){var g={};g.TreeModelIterator=function(){function g(k,e){this.firstLevelChildren=k;this.reset();this._init(e)}g.prototype={_init:function(g){g&&(this.isExpanded=g.isExpanded,this.isExpandable=g.isExpandable,this.forceExpandFunc=g.forceExpandFunc,this.getChildrenFunc=g.getChildrenFunc)},topLevel:function(g){return g.parent?g.parent===this.root:!0},_getChildren:function(g){return"function"===typeof this.getChildrenFunc?this.getChildrenFunc(g):g?g.children:
null},_expanded:function(g){if(!g)return!0;var e=this._getChildren(g),e=e&&0<e.length;this.isExpanded&&e&&(e=this.isExpanded(g));return e},_expandable:function(g){return!g?!0:this.isExpandable?this.isExpandable(g):!1},_diveIn:function(g){return this._expanded(g)?(g=this._getChildren(g),this.setCursor(g[0]),this.cursor()):null},_drillToLast:function(g){return this._expanded(g)?(g=this._getChildren(g),this._drillToLast(g[g.length-1])):g},_forward:function(g){if(!this._cursor)return null;var e=this._diveIn(this._cursor);
if(!e){if(g&&this._expandable(this._cursor)&&this.forceExpandFunc){var d=this;return this.forceExpandFunc(this._cursor,"first",function(e){e&&d.setCursor(e)})}(e=this._findSibling(this._cursor,!0))&&this.setCursor(e)}return e},_backward:function(g){if(!this._cursor)return null;var e=this._findSibling(this._cursor,!1);e&&e!==this._cursor.parent&&(e=this._drillToLast(e));if(g&&e&&this._expandable(e)&&this.forceExpandFunc&&e!==this._cursor.parent){var d=this;return this.forceExpandFunc(e,"last",function(e){e&&
d.setCursor(e)})}e&&this.setCursor(e);return e},_findSibling:function(g,e){for(var d=this.topLevel(g),h=this._getChildren(g.parent),h=d?this.firstLevelChildren:h,b=0;b<h.length;b++)if(h[b]===g)return 0===b&&!e?d?null:g.parent:b===h.length-1&&e?d?null:this._findSibling(g.parent,e):e?h[b+1]:h[b-1];return null},_inParentChain:function(g,e){for(var d=g.parent;d;){if(d===e)return!0;d=d.parent}return!1},_getTopLevelParent:function(g){if(this.topLevel(g))return g;for(g=g.parent;g;){if(this.topLevel(g))return g;
g=g.parent}return null},_onCollapse:function(g){return this._expanded(g.parent)?g:this._onCollapse(g.parent)},_scan:function(g,e,d){this.setCursor(e);var h=[];for(h.push(e);;){if(this.iterate(g))h.push(this.cursor());else break;if(d===this.cursor())return h}return null},setCursor:function(g){this._prevCursor=this._cursor;this._cursor=g},setTree:function(g){this.firstLevelChildren=g;0<this.firstLevelChildren.length&&(this.root=this.firstLevelChildren[0].parent)},scan:function(g,e){var d=this.cursor(),
h=this._scan(!0,g,e);h||(h=this._scan(!1,g,e));this.setCursor(d);return h},iterate:function(g,e){return g?this._forward(e):this._backward(e)},iterateOnTop:function(g,e){var d=this._findSibling(this._getTopLevelParent(this.cursor()),g);d?this.setCursor(d):e&&0<this.firstLevelChildren.length&&this.setCursor(g?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(g){return!this._cursor?null:this._inParentChain(this._cursor,g)?(this.setCursor(g),this._cursor):
null},reset:function(){this.root=this._prevCursor=this._cursor=null;0<this.firstLevelChildren.length&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}};return g}();return g});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(g,l,k){var e={},d=-1!==navigator.userAgent.indexOf("iPad"),h=-1!==window.navigator.platform.indexOf("Mac");e.ExplorerNavHandler=function(){function b(b,c,d){this.explorer=b;this.model=this.explorer.model;this._navDict=c;this._listeners=[];this._selections=[];this._currentColumn=0;b=this._getEventListeningDiv();b.tabIndex=0;b.classList.add("selectionModelContainer");var a=this;this._modelIterator=
new l.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:d.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(c){return a.explorer.renderer.isExpandable(c)}:function(c){return a.isExpandable(c)},forceExpandFunc:this.explorer.forceExpandFunc?function(c,b,d){return a.explorer.forceExpandFunc(c,b,d)}:void 0});this._init(d);(!d||!1!==d.setFocus)&&b.focus();d=function(c){if(k.isFormElement(c.target)||a.explorer.preventDefaultFunc&&a.explorer.preventDefaultFunc(c,
a._modelIterator.cursor()))return!0;if(c.keyCode===g.KEY.DOWN)return a.onDownArrow(c);if(c.keyCode===g.KEY.UP)return a.onUpArrow(c);if(c.keyCode===g.KEY.RIGHT)return a.onRightArrow(c);if(c.keyCode===g.KEY.LEFT)return a.onLeftArrow(c);if(c.keyCode===g.KEY.SPACE)return a.onSpace(c);if(c.keyCode===g.KEY.ENTER)return a.onEnter(c)};b.addEventListener("keydown",d,!1);this._listeners.push({type:"keydown",listener:d});d=function(c){if(a.explorer.onFocus)a.explorer.onFocus(!1);else a.toggleCursor(null,!1)};
b.addEventListener("blur",d,!1);this._listeners.push({type:"blur",listener:d});d=function(c){if(a.explorer.onFocus)a.explorer.onFocus(!0);else a.toggleCursor(null,!0)};b.addEventListener("focus",d,!1);this._listeners.push({type:"focus",listener:d});this._parentDiv=b}b.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(b){this._linearGridMove=!1;b&&(this._selectionPolicy=b.selectionPolicy,this.gridClickSelectionPolicy=b.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc)},_ctrlKeyOn:function(b){return h?b.metaKey:b.ctrlKey},removeListeners:function(){if(this._listeners)for(var b=0;b<this._listeners.length;b++)this._parentDiv.removeEventListener(this._listeners[b].type,this._listeners[b].listener,!1)},focus:function(){var b=this._getEventListeningDiv();b&&b.focus()},_getEventListeningDiv:function(b){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(b):g.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:g.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)))?!0:!1},isExpanded:function(b){return!b?!1:this.explorer.myTree.isExpanded(this.model.getId(b))},refreshSelection:function(b,c){var d=this;this.explorer.selection&&this.explorer.selection.getSelections(function(a){d._clearSelection(c);for(var e=0;e<a.length;e++)d._selections.push(a[e]);0<d._selections.length?d.cursorOn(d._selections[0],
!0,!1,b):d.cursorOn(null,!1,!1,b);d._shiftSelectionAnchor&&0<=d._inSelection(d._shiftSelectionAnchor)||(d._shiftSelectionAnchor=null)})},refreshModel:function(b,c,d,a){this._currentColumn=0;this.topIterationNodes=[];this.model=c;this._navDict=b;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():d&&(this.topIterationNodes=d);this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){b=this.model.getId(b);for(var c=0;c<this._selections.length;c++)if(b===this.model.getId(this._selections[c]))return c;return-1},_clearSelection:function(b){if(b)for(b=0;b<this._selections.length;b++)this._checkRow(this._selections[b],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(b){this._selectionPolicy!==
b&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===b)&&this._toggleSelectionClass("disabledRow","readonlySelection"===b),this._selectionPolicy=b,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(b,c,d){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?c&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0):this._isRowSelectable(b)&&(!c||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b):(c=this._inSelection(b),0<=c?(this._checkRow(b,!0),this._selections.splice(c,1)):(this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b)),d&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(b,c){b||(b=this.currentModel());var d=this._getGridChildren(b);if(d&&1<d.length||
0===c&&d){0!==c&&this.toggleCursor(b,!1);var a=this._currentColumn,e=!0,a=a+c;0>a?(this._linearGridMove&&0!==c&&(this._modelIterator.iterate(!1)?b=this.currentModel():e=!1),a=e?d.length-1:this._currentColumn):a>=d.length&&(this._linearGridMove&&0!==c&&(this._modelIterator.iterate(!0)?b=this.currentModel():e=!1),a=e?0:this._currentColumn);this._currentColumn=a;0!==c&&this.toggleCursor(b,!0);return!0}return!1},_getGridChildren:function(b){return this._navDict?this._navDict.getGridNavHolder(b):null},
getCurrentGrid:function(b){b||(b=this.currentModel());return(b=this._getGridChildren(b))&&0<b.length?b[this._currentColumn]:null},getAriaContainerElement:function(b){for(var c=this._parentDiv,d;b&&b!==c&&"grid"!==(d=b.getAttribute("role"))&&"tree"!==d&&"treegrid"!==d;)b=b.parentNode;return b===c?null:b},toggleCursor:function(b,c){var d=this.getRowDiv(b),a=this.getCurrentGrid(b);a?(d&&(c?d.classList.add("treeIterationCursorRow"):d.classList.remove("treeIterationCursorRow")),a.domNode&&(d=this.getAriaContainerElement(a.domNode),
c?(a.domNode.classList.add("treeIterationCursor"),d&&d.setAttribute("aria-activedescendant",a.domNode.id)):a.domNode.classList.remove("treeIterationCursor"))):d&&(c?d.classList.add("treeIterationCursorRow_Dotted"):d.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,c,d,a){var e,h;if(b||c){if(h===this._modelIterator.cursor())return;e=this._modelIterator.cursor();h=b;this._modelIterator.setCursor(h)}else e=this._modelIterator.prevCursor(),
h=this._modelIterator.cursor();if(e!==h||c)if(this.toggleCursor(e,!1),!c||h){this.moveColumn(null,0);this.toggleCursor(h,!0);if((b=this.getRowDiv())&&!a){a=b.parentNode;for(c=document.documentElement;a&&a!==c;){var g=window.getComputedStyle(a,null);if(!g)break;g=g.getPropertyValue("overflow-y");if("auto"===g||"scroll"===g)break;a=a.parentNode}a&&(c=!0,b.offsetTop<=a.scrollTop?(c=!1,void 0===d&&(d=!1)):b.offsetTop+b.offsetHeight>=a.scrollTop+a.clientHeight&&(c=!1,void 0===d&&(d=!0)),c||b.scrollIntoView(!d))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(e,
h)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=[],c=0;c<this._selections.length;c++)b.push(this.model.getId(this._selections[c]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;b=this.model.getId(b);var c=this._navDict.getValue(b);return c&&c.rowDomNode?c.rowDomNode:g.node(b)},iterate:function(b,c,d,a){var e=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(a){a=this.currentModel();for((e=this._modelIterator.iterate(b,
c))&&this._setCursorOnItem(b,d);e&&e.isNotSelectable;)(e=this._modelIterator.iterate(b,c))&&this._setCursorOnItem(b,d);e||(this.cursorOn(a,!0,!1,!0),this._setCursorOnItem(b,d))}else this._modelIterator.iterate(b,c)&&this._setCursorOnItem(b,d)},_toggleSelectionClass:function(b,c){this._selections.forEach(function(d){(d=this.getRowDiv(d))&&(c?d.classList.add(b):d.classList.remove(b))}.bind(this))},_setCursorOnItem:function(b,c){this.cursorOn(null,!1,b);if(c){var d=this._inSelection(this._modelIterator.prevCursor()),
a=this._inSelection(this._modelIterator.cursor());0<=d&&0<=a?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(b,c){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var d=this.getRowDiv(b);if(d){var a=g.node(this.explorer.renderer.getCheckBoxId(d.id)),e=c?!a.checked:!0;if(e!==a.checked)this.explorer.renderer.onCheck(d,a,e,!0)}}else this._select(b,c)},_select:function(b,c){b||(b=this._modelIterator.cursor());
var d=this.getRowDiv(b);d&&(0>this._inSelection(b)?d.classList.add("checkedRow"):d.classList.remove("checkedRow"))},_onModelGrid:function(b,c){var d=this._getGridChildren(b);if(d)for(var a=0;a<d.length;a++)if(c.target===d[a].domNode)return!0;return!1},onClick:function(b,c){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(b)))g.stop(c);else{var e=g.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)));if(c.target!==e&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(b,c)))if(this.cursorOn(b,!0,!1,!0),d)this.setSelection(b,!0);else if(this._ctrlKeyOn(c))this.setSelection(b,!0,!0);else if(c.shiftKey&&this._shiftSelectionAnchor){if(e=this._modelIterator.scan(this._shiftSelectionAnchor,b)){this._clearSelection(!0);for(var a=0;a<e.length;a++)this.setSelection(e[a],!0)}}else this.setSelection(b,!1,!0)}},onCollapse:function(b){this._modelIterator.collapse(b)&&this.cursorOn()},onUpArrow:function(b){this.iterate(!1,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&
!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},_shouldMoveColumn:function(b){var c=this.currentModel(),d=this._getGridChildren(c);return d&&1<d.length?this.isExpandable(c)?this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),
!0;var c=this._modelIterator.cursor();if(!c)return!1;if(this.isExpandable(c)&&this.isExpanded(c))return this.explorer.myTree.collapse(c),b.preventDefault(),!0;this._modelIterator.topLevel(c)?this.explorer.scopeUp&&"function"===typeof this.explorer.scopeUp&&this.explorer.scopeUp():(this.cursorOn(c.parent),this.setSelection(c.parent,!1,!0))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,1),b.preventDefault(),!0;var c=this._modelIterator.cursor();if(!c)return!1;if(this.isExpandable(c)&&
!this.isExpanded(c))return this.explorer.myTree.expand(c),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(c)),b.preventDefault(),!1},_isRowSelectable:function(b){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(b):!0},onSpace:function(b){this.setSelection(this.currentModel(),!0,!0);b.preventDefault()},onEnter:function(b){var c=this.getCurrentGrid(this._modelIterator.cursor());if(c)if(c.widget)if("function"===typeof c.onClick)c.onClick();else"function"===
typeof c.widget.focus&&c.widget.focus();else{var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);c.domNode.dispatchEvent(d)}else if(c=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(d=this.explorer.renderer.getRowActionElement(this.model.getId(c)),d.href&&(this._ctrlKeyOn(b)?window.open(d.href):window.location.href=d.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(b,
c),b.preventDefault(),!1},setIsNotSelectable:function(b,c){b.isNotSelectable=c},disableItem:function(b){var c=this.getRowDiv(b);this.isExpandable(b)&&this.isExpanded(b)&&(this._modelIterator.collapse(b),this.explorer.myTree.toggle(c.id));c.classList.remove("checkedRow");c.classList.add("disabledNavRow");this.setIsNotSelectable(b,!0)},isDisabled:function(b){return b.classList.contains("disabledNavRow")},enableItem:function(b){var c=this.getRowDiv(b);c&&(c.classList.remove("disabledNavRow"),this.setIsNotSelectable(b,
!1))}};return b}();e.ExplorerNavDict=function(){function b(b){this._dict={};this._model=b}b.prototype={addRow:function(b,c){var d=this._model.getId(b);this._dict[d]={model:b,rowDomNode:c}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,c){if(!b)return null;var d=this._model.getId(b);return this._dict[d]?(!this._dict[d].gridChildren&&c&&(this._dict[d].gridChildren=[]),this._dict[d].gridChildren):null},initGridNavHolder:function(b){if(!b)return null;b=this._model.getId(b);this._dict[b]&&
(this._dict[b].gridChildren=null)}};return b}();return e});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(g,l,k,e,d,h){var b={};b.Explorer=function(){function b(c,d,a,f){this.registry=c;this.renderer=a;this.selection=d;this.commandService=f;this.renderer&&(this.renderer.explorer=this);this.myTree=null}b.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(b,d){this.myTree&&this.myTree.refresh.bind(this.myTree)(b,d,!0)},updateCommands:function(b){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(b)},makeNewItemPlaceHolder:function(b,d,a,f){b=this.getRow(b);if(a)return b=b.childNodes[a],b.appendChild(document.createElement("br")),f=document.createElement("span"),f.id=d+"placeHolderRow",b.appendChild(f),{tempNode:f,refNode:f};if(b){var e=document.createElement("tr");
e.id=d+"placeHolderRow";a=document.createElement("td");a.id=d+"placeHolderCol";e.appendChild(a);f?(b.parentNode.insertBefore(e,b.nextSibling),b=parseInt(b.firstChild.style.paddingLeft),a.style.paddingLeft=this.myTree.getIndent()+b+"px"):b.appendChild(e);f=k.node(d+"placeHolderRow");b=k.node(d+"placeHolderCol");if(f&&b)return{tempNode:f,refNode:b}}return null},getRow:function(b){if(b=this.model.getId(b))return k.node(b)},collapseAll:function(){for(var b=this._navHandler.getTopLevelNodes(),d=0;d<b.length;d++)this.myTree.collapse(b[d])},
expandAll:function(b){if(b)this._expandRecursively(b);else if(this._navHandler){b=this._navHandler.getTopLevelNodes();for(var d=0;d<b.length;d++)this._expandRecursively(b[d])}},_expandRecursively:function(b){if(this._navHandler&&this._navHandler.isExpandable(b)){var d=this;this.myTree.expand(b,function(){d.model.getChildren(b,function(a){if(!(void 0===a||null===a))for(var b=a.length,c=0;c<b;c++)d._expandRecursively(a[c])})})}},createTree:function(b,f,a){b="string"===typeof b?b:b.id||b;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var h=b+"innerTree",g=k.node(h);g&&k.empty(g);f&&(f.rootId=h);this.model=f;this._parentId=b;this._treeOptions=a;if(!a||a&&!a.noSelection)this.selectionPolicy=a?a.selectionPolicy:"",this._navDict=new d.ExplorerNavDict(this.model);this.myTree=new e.TableTree({id:h,model:f,parent:b,onComplete:a?a.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:a?!!a.showRoot:
!1,indent:a?a.indent:void 0,onCollapse:a?a.onCollapse:void 0,navHandlerFactory:a?a.navHandlerFactory:void 0,tableElement:a?a.tableElement:void 0,tableBodyElement:a?a.tableBodyElement:void 0,tableRowElement:a?a.tableRowElement:void 0});this.renderer._initializeUIState();"cursorOnly"===this.selectionPolicy&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var b=this.getNavHandler(),d=[];
if(b&&this.getNavDict())for(var a=b.getSelection(),f=0;f<a.length;f++){var e=b.getRowDiv(a[f]);e&&e.parentNode&&(e=this.getNavDict().getValue(this.model.getId(a[f])),e.model&&d.push(e.model))}this.selection.setSelections(d)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var b=this._treeOptions;if(!b||b&&!b.noSelection){this.getNavHandler()||(this._navHandler=b&&b.navHandlerFactory&&"function"===typeof b.navHandlerFactory.createNavHandler?
b.navHandlerFactory.createNavHandler(this,this._navDict,b):new d.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:b?b.getChildrenFunc:null,setFocus:b&&b.setFocus,selectionPolicy:b?b.selectionPolicy:null}));var f=this;this.model.getRoot(function(a){a instanceof Array?f.getNavHandler().refreshModel(f.getNavDict(),f.model,a):a.children&&a.children instanceof Array&&f.getNavHandler().refreshModel(f.getNavDict(),f.model,a.children);b&&b.setFocus&&f.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,
checkbox:!1};return b}();b.createExplorerCommands=function(b,c){function d(a){return"function"===typeof a.getItemCount&&0<a.getItemCount()?c?c(a):!0:!1}var a=new h.Command({tooltip:g["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return d(a)},callback:function(a){a.items.expandAll()}}),e=new h.Command({tooltip:g["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",
visibleWhen:function(a){return d(a)},callback:function(a){a.items.collapseAll()}});b.addCommand(a);b.addCommand(e)};b.ExplorerModel=function(){function b(c,d,a){this.rootPath=c;this.fetchItems=d;this.idPrefix=a||""}b.prototype={destroy:function(){this.destroyed=!0},getRoot:function(b){var d=this;this.fetchItems(this.rootPath).then(function(a){d.root=a;b(a)})},getChildren:function(b,d){b.Children?d(b.Children):b.ChildrenLocation?this.fetchItems(b.ChildrenLocation).then(function(a){b.Children=a;d(a)}):
d([])},getId:function(b){if(b.Location===this.root.Location)return this.rootId;b=b.Location.replace(/[\\\/]/g,"");for(var d=this.idPrefix,a=0;a<b.length;a++)d=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?d+b.charCodeAt(a):d+b[a];return d}};return b}();b.ExplorerFlatModel=function(){function d(b,f,a){this.rootPath=b;this.fetchItems=f;this.root=a}d.prototype=new b.ExplorerModel;d.prototype.getRoot=function(b){if(this.root)b(this.root);else{var d=this;this.fetchItems(this.rootPath).then(function(a){d.root=a;
b(a)})}};d.prototype.getChildren=function(b,d){b===this.root?d(this.root):d([])};return d}();b.ExplorerRenderer=function(){function b(c,d){this.explorer=d;this._init(c);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(b){b&&(this._useCheckboxSelection=void 0===b.checkbox?!1:b.checkbox,this.selectionPolicy=b.singleSelection?"singleSelection":
"",this._cachePrefix=b.cachePrefix,this.getCheckedFunc=b.getCheckedFunc,this.onCheckedFunc=b.onCheckedFunc,this._highlightSelection=!0,this._treeTableClass=b.treeTableClass||"treetable",!1===b.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=b.actionScopeId),this.commandService||(this.commandService=b.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(b,d){this.tableTree=d;this.tableNode=b;k.empty(b);this._treeTableClass&&
b.classList.add(this._treeTableClass);this.renderTableHeader(b)},getActionsColumn:function(b,d,a,f,e){a=a||"tool";var h=document.createElement("td");h.id=d.id+"actionswrapper";f&&h.classList.add(f);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,h,b,this.explorer,a,null,e&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(b,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return h},initCheckboxColumn:function(b){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(b,d){if(this._useCheckboxSelection){var a=document.createElement("td"),f=document.createElement("span");f.id=this.getCheckBoxId(d.id);f.classList.add("core-sprite-check");f.classList.add("selectionCheckmarkSprite");f.rowId=d.id;this.getCheckedFunc&&(f.checked=this.getCheckedFunc(b),f.checked?(this._highlightSelection&&d.classList.add("checkedRow"),f.classList.add("core-sprite-check_on")):
(this._highlightSelection&&d.classList.remove("checkedRow"),f.classList.remove("core-sprite-check_on")));a.appendChild(f);var e=this;f.addEventListener("click",function(a){e.onCheck(d,a.target,a.target.checked?!1:!0,!0)},!1);return a}},getCheckBoxId:function(b){return b+"selectedState"},onCheck:function(b,d,a,f,e){(d.checked=a)?d.classList.add("core-sprite-check_on"):d.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(d.rowId,a,f);this.explorer.getNavHandler()&&e&&
this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(b.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var b=this.explorer.getNavHandler().getSelectionIds(),d=this._getUIStatePreferencePath();d&&window.sessionStorage&&(window.sessionStorage[d+"selection"]=JSON.stringify(b))}},_restoreSelections:function(b){var d=this.explorer.getNavDict(),a=this.explorer.getNavHandler();if(a&&d&&"cursorOnly"!==a.getSelectionPolicy()&&(b=window.sessionStorage[b+
"selection"],"string"===typeof b&&(b=0<b.length?JSON.parse(b):null),b)){for(var f=[],a=0;a<b.length;a++){var e=d.getValue(b[a]);if(e&&e.rowDomNode&&e.model&&(f.push(e.model),this._highlightSelection&&e.rowDomNode.classList.add("checkedRow"),e=k.node(this.getCheckBoxId(e.rowDomNode.id))))e.checked=!0,e.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(f),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(b){window.sessionStorage[b+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(b){var d=!1,a=window.sessionStorage[b+"expanded"];"string"===typeof a&&(a=0<a.length?JSON.parse(a):null);var f;if(a)for(f=0;f<a.length;f++)if(k.node(a[f])){this._expanded.push(a[f]);var e=this;this.tableTree.expand(a[f],function(){e._restoreSelections(b)});d=!0}return!d},_getUIStatePreferencePath:function(){if(this.explorer){var b=this.explorer.getRootPath();if(this._cachePrefix&&b)return b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+b+"/uiState"}return null},expandCollapseImageId:function(b){return b+"__expand"},updateExpandVisuals:function(b,d){var a=k.node(this.expandCollapseImageId(b.id));a&&(a.classList.remove(this._expandImageClass),a.classList.remove(this._collapseImageClass),a.classList.remove(this._progressImageClass),a.classList.add("progress"===d?this._progressImageClass:d?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(b,d,a,f){var e=document.createElement("span");
e.id=this.expandCollapseImageId(b.id);d.appendChild(e);e.classList.add(this._twistieSpriteClass);e.classList.add(this._collapseImageClass);if(a){var h=document.createElement("span");d.appendChild(h);h.classList.add(f||"imageSprite");h.classList.add(a)}var g=this;e.onclick=function(a){if(!g.explorer.getNavHandler().isDisabled(b)){g.tableTree.toggle(b.id);if(g.tableTree.isExpanded(b.id))g._expanded.push(b.id),g.explorer.postUserExpand&&g.explorer.postUserExpand(b.id);else for(var d in g._expanded)if(g._expanded[d]===
b.id){g._expanded.splice(d,1);break}(a=g._getUIStatePreferencePath())&&window.sessionStorage&&g._storeExpansions(a)}};return e},render:function(b,d){d.classList.add("navRow");this.renderRow(b,d)},rowsChanged:function(){"cursorOnly"!==this.explorer.selectionPolicy&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(k.$(".sectionTreeTable",this.tableNode.parentNode)||k.$(".treetable",this.tableNode.parentNode))&&k.$$array(".treeTableRow",this.tableNode).forEach(function(b,d){var a=!(d%
2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",f="darkSectionTreeTableRow"===a?"lightSectionTreeTableRow":"darkSectionTreeTableRow";b.classList.add(a);b.classList.remove(f)})},updateCommands:function(){if(this.commandService)for(var b=k.$$array(".treeTableRow"),d=0;d<b.length;d++){var a=b[d],f=k.node(a.id+"actionswrapper");this.commandService.destroy(f);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,f,a._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var b=this._getUIStatePreferencePath();b&&window.sessionStorage&&this._restoreExpansions(b)&&this._restoreSelections(b)}};return b}();b.SelectionRenderer=function(){function d(b,f){this._init(b);this.explorer=f}d.prototype=new b.ExplorerRenderer;d.prototype.renderTableHeader=function(b){var d=document.createElement("thead"),a=document.createElement("tr");d.classList.add("navTableHeading");this._useCheckboxSelection&&a.appendChild(this.initCheckboxColumn(b));for(var f=0,e=this.getCellHeaderElement(f);e;)0<
e.innerHTML.length&&e.classList.add("navColumn"),a.appendChild(e),e=this.getCellHeaderElement(++f);d.appendChild(a);0<f&&b.appendChild(d)};d.prototype.renderRow=function(b,d){d.verticalAlign="baseline";d.classList.add("treeTableRow");"cursorOnly"!==this.explorer.selectionPolicy&&d.classList.add("selectableNavRow");var a=this.explorer.getNavDict();if(a){a.addRow(b,d);var f=this;d.addEventListener("click",function(a){if(f.explorer.getNavHandler())f.explorer.getNavHandler().onClick(b,a)},!1)}if(a=this.getCheckboxColumn(b,
d))a.classList.add("checkColumn"),d.appendChild(a);for(var a=0,e=this.getCellElement(a,b,d);e;)d.appendChild(e),0===a?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle(b)):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++a,b,d)};d.prototype.getCellHeaderElement=function(b){};d.prototype.getCellElement=function(b,d,a){};return d}();b.SimpleFlatModel=function(){function d(b,
f,a){this.items=b;this.getKey=a;this.idPrefix=f;this.root={children:b}}d.prototype=new b.ExplorerModel;d.prototype.getRoot=function(b){b(this.root)};d.prototype.getId=function(b){b=this.getKey(b).replace(/[\\\/]/g,"");for(var d="",a=0;a<b.length;a++)d=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?d+b.charCodeAt(a):d+b[a];return this.idPrefix+d};d.prototype.getChildren=function(b,d){b===this.root?d(this.items):d([])};return d}();return b});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages orion/Deferred orion/explorers/explorer orion/explorers/navigationUtils orion/extensionCommands orion/objects orion/URITemplate orion/webui/littlelib".split(" "),function(g,l,k,e,d,h,b,f){function c(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function m(a,f,e,m,g,k,z,A,C){f=h.clone(f);var p;if(f.Directory)p=document.createElement("a"),
p.className="navlinkonpage",p.href=!a?n:(new b(a+"#{,resource,params*}")).expand({resource:f.ChildrenLocation}),f.Name&&p.appendChild(document.createTextNode(f.Name));else{g||(g=d.getOpenWithCommands(e));p=document.createElement("a");p.className="navlink targetSelector";k&&"object"===typeof k&&Object.keys(k).forEach(function(a){p[a]=k[a]});var w=null,r=null;if(w=A?A.holderDom:p)r=document.createElement("span"),r.className="core-sprite-file modelDecorationSprite thumbnail",w.appendChild(r);f.Name&&
p.appendChild(document.createTextNode(f.Name));var B=f.Location;z&&"object"===typeof z&&(f.params={},h.mixin(f.params,z));(a=d.getOpenWithCommand(e,f,g))&&(B=a.hrefCallback({items:f}));l.when(m.getFileContentType(f),function(a){if(w){var b=w,d=r;if(a){var e,h=a.imageClass,m=a.image;h?(e=document.createElement("span"),e.className+=h,e.classList.add("thumbnail")):m&&(e=document.createElement("img"),e.src=m,e.classList.add("thumbnail"));e&&b.replaceChild(e,d)}}p.href=B;C&&"function"===typeof C.updateFileNode&&
C.updateFileNode(f,p,c(a))})}p.addEventListener("click",function(){q=f}.bind(this),!1);return p}function a(a,b,c,d){this.explorer=b;this.commandService=c;this.contentTypeService=d;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var n=new b("#{,resource,params*}"),q;a.prototype=new k.SelectionRenderer;a.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};a.prototype.tableCallback=function(a){a.setAttribute("aria-label",g.Navigator);a.setAttribute("role",
"presentation")};a.prototype.rowCallback=function(a,b){a.setAttribute("role","treeitem")};a.prototype.emptyCallback=function(a){var b=document.createElement("tr"),c=document.createElement("td");c.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent=g.NoFile;var e=document.createElement("span");e.appendChild(document.createTextNode(g.File));f.processDOMNodes(d,[e]);c.appendChild(d);b.appendChild(c);a.appendChild(b)};a.prototype.getCellHeaderElement=
function(a){if(this.oneColumn&&0!==a)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};a.prototype.setTarget=function(a){this.target=a};a.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};a.prototype.createFolderNode=function(a){var b;this.showFolderLinks?(b=m(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&
b.insertBefore(a,b.firstChild)):(b=document.createElement("span"),b.textContent=a.Name);return b};a.prototype.updateFileNode=function(a,b,c){};a.prototype.showFolderLinks=!0;a.prototype.getCellElement=function(a,b,c){switch(a){case 0:a=document.createElement("td");var f=document.createElement("span");f.id=c.id+"MainCol";f.setAttribute("role","presentation");a.appendChild(f);a.setAttribute("role","presentation");f.className="mainNavColumn";var h;b.Directory?(this.getExpandImage(c,f),h=this.createFolderNode(b),
f.appendChild(h),this.explorer._makeDropTarget(b,h),this.explorer._makeDropTarget(b,c)):(this.openWithCommands||(this.openWithCommands=d.getOpenWithCommands(this.commandService)),h=m("",b,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this),f.appendChild(h));h&&(h.id=c.id+"NameLink",1===h.nodeType&&(e.addNavGrid(this.explorer.getNavDict(),b,h),h.setAttribute("role","link"),h.setAttribute("tabindex","-1")));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,
f,b,this.explorer,"tool",null,!0);return a;case 1:if(this.oneColumn)return null;c=document.createElement("td");b.LocalTimeStamp&&(c.textContent=(new Date(b.LocalTimeStamp)).toLocaleString());return c;case 2:if(this.oneColumn)return null;c=document.createElement("td");!b.Directory&&"number"===typeof b.Length&&(b=parseInt(b.Length,10)/1024,c.textContent=Math.ceil(b).toLocaleString()+" KB");c.style.textAlign="right";return c}};a.prototype.constructor=a;return{NavigatorRenderer:a,isImage:c,getClickedItem:function(){return q},
createLink:m}});
define("orion/searchClient","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/searchUtils orion/crawler/searchCrawler orion/explorers/navigatorRenderer orion/extensionCommands orion/Deferred".split(" "),function(g,l,k,e,d,h,b,f,c){function m(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function a(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new m(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}m.prototype.makeRenderFunction=function(a,h,m,t,y){var u=this.serviceRegistry,v=this.commandRegistry;this.openWithCommands=this.openWithCommands||f.createOpenWithCommands(u,a,v);var x=this;return function(f,u,C,p){c.when(x.openWithCommands,function(c){if(C)k.empty(h),c=document.createElement("div"),c.appendChild(document.createTextNode(g["Search failed."])),h.appendChild(c),"function"===typeof t&&t(h);else{var r=
function(){function a(b,c){var d=c.folderName?c.folderName:c.path,p=document.createElement("span");p.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");p.appendChild(document.createTextNode(" - "+d+" "));b.appendChild(p)}var b={};return function(c,d){var p=d.name;if(b.hasOwnProperty(p)){a(c,d);var f=b[p];"function"===typeof f&&(b[p]=null,f())}else b[p]=function(){a(c,d)}}}(),B=!1;k.empty(h);if(f&&0<f.length){var D=document.createElement("table");D.setAttribute("role","presentation");for(var I=0;I<f.length;I++){var F=
f[I],J;B||(B=!0,m&&(J=D.insertRow(0).insertCell(0),J.textContent=m));J=D.insertRow(-1).insertCell(0);J.colspan=2;y&&y(J);var x={Name:F.name,Directory:F.directory,Location:F.path||F.location},G=null;"number"===typeof F.LineNumber&&(G={},G.line=F.LineNumber);if(p&&p.keyword&&!p.nameSearch){var H=d.generateSearchHelper(p),G=G||{};G.find=H.inFileQuery.searchStr;G.regEx=H.inFileQuery.wildCard?!0:void 0}x=b.createLink(l.toUrl("edit/edit.html"),x,v,a,c,{"aria-describedby":(F.folderName?F.folderName:F.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},G);F.LineNumber&&x.appendChild(document.createTextNode(" (Line "+F.LineNumber+")"));J.appendChild(x);r(J,F)}h.appendChild(D);"function"===typeof t&&t(h)}!B&&u&&(c=e.formatMessage(g["No matches found for ${0}"],u),k.empty(h),h.appendChild(document.createTextNode(c)),"function"===typeof t&&t(h))}})}};a.prototype={search:function(a,b,c){var f=function(a){for(var c=[],f=0;f<a.response.docs.length;f++){var e=a.response.docs[f],h=e.Location,m=d.path2FolderName(e.Path?
e.Path:e.Location,e.Name),p=m?m:h;(b?0<=p.indexOf(b):1)&&c.push({name:e.Name,path:h,folderName:m,directory:e.Directory,lineNumber:e.LineNumber})}return c};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){c(f(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var d=a.keyword,d=d.substring(d.indexOf("}")+1),d=d.substring(d.indexOf(":")+1);c(f(b),d,null,a)},function(a){c(null,
null,a,null)})}catch(e){"string"===typeof e&&-1<e.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(b){c(f(b),null,null,a)}):"string"===typeof e&&-1<e.indexOf("search")&&!a.nameSearch?(new h.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){c(f(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(e)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);k.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var c="",d=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&0<a.Parents.length?d="last"===b.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(d=a);d?(this.setLocationbyURL(d.Location),c=d.Name,this._childrenLocation=d.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
c=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);d=k.node("search");c||(c="");if(d&&d.placeholder){d.value="";var f=e.formatMessage(g["Search ${0}"],c);d.placeholder=30<f.length?f.substring(0,27)+"...":e.formatMessage(g["Search ${0}"],c)}d&&d.title&&(d.title=g["Type a keyword or wild card to search in "]+c)},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,c,d){c=c?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:c,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:c,sort:d&&d.sort?d.sort:"Path asc",rows:d&&d.rows?d.rows:40,start:0,caseSensitive:d?d.caseSensitive:void 0,regEx:d?d.regEx:void 0,fileType:d?d.fileType:void 0,keyword:a,replace:d?d.replace:void 0}}};a.prototype.constructor=a;return{Searcher:a}});
define("orion/section","orion/webui/littlelib orion/selection orion/commandRegistry orion/commonHTMLFragments orion/objects orion/selection".split(" "),function(g,l,k,e,d,h){function b(b,d){var a=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!d.id)throw Error("Missing required argument: id");this.id=d.id;if(!d.title)throw Error("Missing required argument: title");var f=d.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");b.appendChild(this.domNode);for(var h=0;h<f.length;h++)this.domNode.classList.add(f[h]);this.domNode.id=d.id;d.canHide&&(this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=
0,this.domNode.addEventListener("click",function(b){(b.target===a.titleNode||b.target===a.twistie||b.target===a.domNode)&&a._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(b){b.keyCode===g.KEY.ENTER&&(b.target===a.domNode||b.target===a.titleNode||b.target===a.twistie)&&a._changeExpandedState()},!1));if(d.iconClass){var k=document.createElement("span");k.classList.add("sectionIcon");this.domNode.appendChild(k);f=Array.isArray(d.iconClass)?d.iconClass:[d.iconClass];f.forEach(function(a){k.classList.add(a)})}d.headerClass&&
(f=Array.isArray(d.headerClass)?d.headerClass:[d.headerClass],f.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=d.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=d.title;"function"===typeof d.getItemCount&&(f=document.createElement("div"),f.classList.add("layoutLeft"),
f.classList.add("sectionItemCount"),this.domNode.appendChild(f),f.textContent=d.getItemCount(this));this._progressNode=document.createElement("div");this._progressNode.id=d.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);f=document.createElement("div");f.id=d.id+
"FilterSearchBox";this.domNode.appendChild(f);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=d.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("ul");this.actionsNode.id=d.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");this.actionsNode.classList.add("sectionActions");
this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=d.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);d.slideout&&(f=e.slideoutHTMLFragment(d.id),h=document.createRange(),h.selectNode(this.domNode),f=h.createContextualFragment(f),this.domNode.appendChild(f));this._contentParent=
document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);b.appendChild(this._contentParent);d.content&&this.setContent(d.content);"function"===typeof d.onExpandCollapse&&(this._onExpandCollapse=d.onExpandCollapse);this._preferenceService=d.preferenceService;this._collapse();if(this._preferenceService){var l=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=
a.get(l.id);void 0===a?d.hidden||l._expand():a&&l._expand();l._updateExpandedState(!1)})}else d.hidden||this._expand(),this._updateExpandedState(!1);this._commandService=d.commandService;this._lastMonitor=0;this._loading={}}function f(b){this._section=b;this._id=++b._lastMonitor}b.prototype={setTitle:function(b){this.titleNode.textContent=b},getHeaderElement:function(b){return this.domNode},getTitleElement:function(b){return this.titleNode},getActionElement:function(b){return this._toolActionsNode},
setContent:function(b){"string"===typeof b?this._contentParent.innerHTML=b:(this._contentParent.innerHTML="",this._contentParent.appendChild(b))},getContentElement:function(){return this._contentParent},embedExplorer:function(b,f,a){this._contentParent.innerHTML="";b.parent||(b.parent=f);this._contentParent.appendChild(b.parent);b.section=this;d.mixin(b,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!g.node(a)){var b=document.createElement("ul");
b.id=a;b.classList.add("commandList");b.classList.add("layoutRight");this.section.actionsNode.appendChild(b)}}.bind(this))},getCommandsVisible:function(){return"hidden"!==this.section.actionsNode.style.visibility},setCommandsVisible:function(a,b){this.section.actionsNode.style.visibility=a?"":"hidden";void 0===b&&(b=a?null:"cursorOnly");this.renderer.selectionPolicy=b;var c=this.getNavHandler();c&&c.setSelectionPolicy(b);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){g.node(a)&&
this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(b){delete a[b]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var b=this;!this.selection&&!a&&(this.serviceRegistry||this.registry?(this.selection=
new h.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(a){b.updateCommands(a.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry"));var c=this.registerCommands();!c||!c.then?b.updateCommands():c.then(function(){b.updateCommands()})}});b.renderer&&(b.renderer.section=this,d.mixin(b.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,
a))&&this.section.setTitle(a.innerHTML);return null}}))},createProgressMonitor:function(){return new f(this)},_setMonitorMessage:function(b,d){this._progressNode.style.visibility="visible";this._loading[b]=d;var a="",f;for(f in this._loading)""!==a&&(a+="\n"),a+=this._loading[f];this._progressNode.title=a},_monitorDone:function(b){delete this._loading[b];b="";for(var d in this._loading)""!==b&&(b+="\n"),b+=this._loading[d];this._progressNode.title=b;""===b&&(this._progressNode.style.visibility="hidden")},
_changeExpandedState:function(){this.hidden?this._expand():this._collapse();this._updateExpandedState(!0)},_updateExpandedState:function(b){var d=!this.hidden,a=this.twistie,f=this.id;a&&(a.classList.add(d?this._expandImageClass:this._collapseImageClass),a.classList.remove(d?this._collapseImageClass:this._expandImageClass));this._preferenceService&&b&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(f,d)});this._onExpandCollapse&&this._onExpandCollapse(d,this)},_expand:function(){this._contentParent.classList.remove("sectionClosed");
this.domNode.classList.remove("sectionClosed");this.hidden=!1},_collapse:function(){this.hidden=!0;this._contentParent.classList.add("sectionClosed");this.domNode.classList.add("sectionClosed")}};b.prototype.constructor=b;f.prototype={begin:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},worked:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},done:function(b){this.status=b;this._section._monitorDone(this.id)}};f.prototype.constructor=f;return{Section:b}});
define("orion/git/util",["orion/URL-shim"],function(g){function l(e){for(var b=0;b<d.length;b++)if(e.type===d[b])return!0;return!1}function k(d){for(var b=0;b<e.length;b++)if(d.type===e[b])return!0;return!1}var e=["Missing","Modified","Untracked","Conflicting"],d=["Added","Changed","Removed"];return{statusUILocation:"git/git-status.html",isStaged:l,isUnstaged:k,isChange:function(d){return l(d)||k(d)},hasStagedChanges:function(e){for(var b=0;b<d.length;b++)if(0<e[d[b]].length)return!0;return!1},hasUnstagedChanges:function(d){for(var b=
0;b<e.length;b++)if(0<d[e[b]].length)return!0;return!1},parseSshGitUrl:function(d){try{var b=new URL(d);return{host:b.hostname,port:b.port}}catch(f){try{var c=d.split(":")[0].split("@");return{host:1<c.length?c[1]:c[0],port:22}}catch(e){return{host:"",port:""}}}},trimCommitMessage:function(d){d=d.split(/\r\n|\n/);for(var b=0;0<d.length&&/^\s*$/.test(d[b]);)b++;return 100<d[b].length?d[b].substring(0,100)+"...":d[b]},getGerritFooter:function(d){d=d.split(/\r\n|\n/);for(var b={},f=0,c=d.length-1;0<=
c;--c)if(0===d[c].indexOf("Change-Id: ")){if(b.changeId=d[c].substring(11,d[c].length),1<++f){b={};break}}else 0===d[c].indexOf("Signed-off-by: ")&&(b.signedOffBy=d[c].substring(15,d[c].length));return b}}});
define("orion/compare/compareUtils",["orion/URITemplate"],function(g){var l=l||{};l.compareUtils=l.compareUtils||{};l.compareUtils.lookUpMapper=function(g,e,d){for(var h=0,b=0;b<g.length;b++){var f=g[b][e];0===f&&(f=1);if(d>=h&&d<h+f)return{mapperIndex:b,startFrom:h};if(b===g.length-1)break;h+=g[b][e]}return{mapperIndex:g.length-1,startFrom:h}};l.compareUtils.lookUpLineIndex=function(g,e,d){if(0===d)return 0;for(var h=0,b=0;b<d;b++)h+=g[b][e];return h};l.compareUtils.updateMapper=function(g,e,d,h,
b){if(h!==b&&(0<h||0<b)){var f=l.compareUtils.lookUpMapper(g,e,d);if(!(0>f.mapperIndex)){if(0<h){var c=d-f.startFrom;for(d=f.mapperIndex;d<g.length;d++){c=g[d][e]-c;if(h<=c){g[d][e]-=h;break}g[d][e]-=c;h-=c;c=0}}0<b&&(g[f.mapperIndex][e]+=b)}}};l.compareUtils.overlapMapper=function(g,e,d,h,b){g=d+g[e]-1;g<d&&(g=d);b<h&&(b=h);return g<h||b<d?!1:!0};l.compareUtils.findFirstDiff=function(g,e,d,h){for(var b=0,f=null,c=0;c<g.length&&!(b>h)&&(!l.compareUtils.overlapMapper(g[c],e,b,d,h)||!(f={mapperIndex:c,
startFrom:b},0!==g[c][2]));c++)b+=g[c][e];return f};l.compareUtils.matchMapper=function(g,e,d,h){if(0===g.length)return d;var b=d+Math.round((h-d)/3),f=l.compareUtils.findFirstDiff(g,e,d,h),c=0===g[f.mapperIndex][e]?f.startFrom:f.startFrom+g[f.mapperIndex][e]-1,m=l.compareUtils.lookUpLineIndex(g,1-e,f.mapperIndex),a=f.startFrom-d;return 0===g[f.mapperIndex][2]?m-a:b>=f.startFrom&&b<=c?m-Math.round((h-d)/3):b<f.startFrom?m-a:(0===g[f.mapperIndex][1-e]?m:m+g[f.mapperIndex][1-e]-1)-(c-d)};l.compareUtils.getMapperLineCount=
function(g){for(var e=0,d=0;d<g.length;d++)e+=Math.max(g[d][0],g[d][1]);return e};l.compareUtils.getAnnotationIndex=function(g,e){for(var d=0;d<g.length;d++)if(g[d][0]===e)return d;return-1};l.compareUtils.getAnnotationMapperIndex=function(g,e){return g[e][1]};l.compareUtils.getAnnotationIndexByMapper=function(g,e){for(var d=0;d<g.length;d++)if(g[d][1]===e)return{current:d,prev:d-1,next:d+1};return{current:-1,prev:-1,next:-1}};l.compareUtils.isMapperConflict=function(g,e){return 0>e||!g[e][3]?!1:
1===g[e][3]};l.compareUtils.mergeDiffBlocks=function(g,e,d,h,b,f){for(var c=0;c<e.length;c++){var m=e[c][0],a=d[e[c][1]];if(0<a[0]){for(var n="",q=0;q<a[0];q++)n=n+h[a[2]-1+q].substring(b)+f;a=g.getLineCount();m>=a&&(m=g.getLineEnd(a-1),q=g.getLineEnd(a-1,!0),m===q?(g.setText(f,m,m),m=a):m=a-1);m=g.getLineStart(m);g.setText(n,m,m)}}};l.compareUtils.generateCompareHref=function(k,e){var d=require.toUrl("compare/compare.html");e.conflict||(e.conflict=void 0);e.readonly||(e.readonly=void 0);return(new g(d+
"#{,resource,params*}")).expand({resource:k,params:e})};l.compareUtils.generateCompareTreeHref=function(k,e){var d=require.toUrl("compare-tree/compare-tree.html");return(new g(d+"#{,resource,params*}")).expand({resource:k,params:e})};return l.compareUtils});
define("orion/git/gitPreferenceStorage",["orion/Deferred"],function(g){function l(g){this._prefix="/git/credentials";this._preferenceService=g.getService("orion.core.preference")}l.prototype={put:function(k,e){var d={gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""};void 0!==e&&(void 0!==e.gitSshUsername&&null!==e.gitSshUsername&&(d.gitSshUsername=e.gitSshUsername),void 0!==e.gitSshPassword&&null!==e.gitSshPassword&&(d.gitSshPassword=e.gitSshPassword),void 0!==e.gitPrivateKey&&
null!==e.gitPrivateKey&&(d.gitPrivateKey=e.gitPrivateKey),void 0!==e.gitPassphrase&&null!==e.gitPassphrase&&(d.gitPassphrase=e.gitPassphrase));var h=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(b){var f=b.get("settings");void 0===f?h.reject():f.enabled?(b.put(k,d),h.resolve()):h.reject()});return h},get:function(k){var e={gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""},d=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(h){var b=
h.get("settings");void 0===b?d.reject():b.enabled?(h=h.get(k),void 0!==h?d.resolve(h):d.resolve(e)):d.reject()});return d},isEnabled:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(e){e=e.get("settings");void 0===e?k.resolve(!1):k.resolve(e.enabled)});return k},enable:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(e){e.put("settings",{enabled:!0});k.resolve()});return k},disable:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,
2).then(function(e){e.put("settings",{enabled:!1});k.resolve()});return k},remove:function(k){var e=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(d){d.remove(k);e.resolve()});return e},getRepositories:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(e){var d=[];e=e.keys();for(var h=0;h<e.length;++h)"settings"!==e[h]&&d.push(e[h]);k.resolve(d)});return k}};return l.prototype.constructor=l});
define("orion/git/gitConfigPreference",["orion/Deferred"],function(g){function l(g){this._prefix="/git/config";this._preferenceService=g.getService("orion.core.preference")}l.prototype={getConfig:function(){var k=new g;this._preferenceService.getPreferences(this._prefix).then(function(e){e=e.get("userInfo");k.resolve(e)});return k},setConfig:function(k){var e=new g;this._preferenceService.getPreferences(this._prefix).then(function(d){d.put("userInfo",k);e.resolve()});return e}};return l.prototype.constructor=
l});
define("orion/git/widgets/ConfirmPushDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv id\x3d"header"\x3e\x3c/div\x3e';k.prototype._init=function(e){var d=this;this.title="Git Push";this.modal=!0;this.messages=g;this.location=e.location;this.dialog2=e.dialog;this.func=e.func;this.buttons=[];this.dialog2&&this.buttons.push({callback:function(){d.destroy();d.dialog2.show()},text:"More"});this.buttons.push({callback:function(){d.destroy();d.func()},
text:"OK"});this._initialize()};k.prototype._bindToDom=function(e){e=this.$header;e.appendChild(document.createTextNode("You are going to push to the following remote: "+this.location));e.appendChild(document.createElement("br"));this.dialog2&&e.appendChild(document.createTextNode(" Click More to push to another remote or OK to push to default."))};k.prototype.constructor=k;return{ConfirmPushDialog:k}});
define("orion/git/widgets/RemotePrompterDialog",["i18n!git/nls/gitmessages","orion/webui/dialog","orion/explorers/explorer","orion/selection"],function(g,l,k,e){function d(b,c){this.explorer=c;this._init(b)}function h(b){this._init(b)}var b=function(){function b(c,d,a,f){this.gitClient=c;this.rootPath=d;this.fetchItems=a;this.root=f?f:null}b.prototype=new k.ExplorerModel;b.prototype.getRoot=function(b){var d=this;this.root?b(this.root):this.fetchItems(this.rootPath).then(function(a){d.root=a;b(a)})};
b.prototype.getIdentity=function(b){b.Location?(b=b.Location,b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")):b="ROOT";return b};b.prototype.getChildren=function(b,d){b.children=[];if(b.Children){for(var a=0;a<b.Children.length;a++)b.Children[a].parent=b,b.children[a]=b.Children[a];d(b.Children)}else b.BranchLocation&&b.RemoteLocation?(b.children=[{GroupNode:"true",Location:b.BranchLocation,Name:"Branches",parent:b},{GroupNode:"true",Location:b.RemoteLocation,BranchLocation:b.BranchLocation,Name:"Remotes",
parent:b},{GroupNode:"true",Location:b.TagLocation,Name:"Tags",parent:b}],d(b.children)):b.GroupNode?this.gitClient.getGitBranch(b.Location).then(function(a){b.children=a.Children;for(var f=0;f<a.Children.length;f++)a.Children[f].parent=b;d(a.Children)}):"Remote"===b.Type&&this.gitClient.getGitBranch(b.Location).then(function(a){b.children=a.Children;for(var f=0;f<a.Children.length;f++)a.Children[f].parent=b;d(a.Children)})};return b}();d.prototype=new k.SelectionRenderer;d.prototype.constructor=
d;d.prototype.getLabelColumnIndex=function(){return 0};d.prototype.getCellElement=function(b,c,d){var a=document.createElement("td");d.appendChild(a);b=document.createElement("span");b.id=d.id+"navSpan";a.appendChild(b);b.className="mainNavColumn singleNavColumn";(c.children||c.Children||c.GroupNode||"Remote"===c.Type||c.BranchLocation&&c.RemoteLocation)&&this.getExpandImage(d,b);d=c.Name;"RemoteTrackingBranch"===c.Type&&!c.Id&&(d=c.Name+g[" [New branch]"]);b.appendChild(document.createTextNode(d))};
h.prototype=new l.Dialog;h.prototype.TEMPLATE='\x3cdiv\x3e\x3cdiv id\x3d"treeContentPane" style\x3d"width:25em; min-height: 25em; max-height: 30em; height: auto; overflow-y: auto; padding: 8px"\x3e\x3c/div\x3e\x3cdiv id\x3d"newBranchPane" style\x3d"padding: 8px"\x3e\x3clabel for\x3d"newBranch"\x3e${New Branch:}\x3c/label\x3e\x3cinput id\x3d"newBranch" value\x3d"" disabled\x3dtrue/\x3e\x3c/div\x3e\x3c/div\x3e';h.prototype._init=function(b){var c=this;this.title=b.title||g["Choose a Folder"];this.modal=
!0;this.messages=g;this.func=b.func;this.treeRoot=b.treeRoot;this.gitClient=b.gitClient;this.hideNewBranch=b.hideNewBranch;this.serviceRegistry=b.serviceRegistry;this.buttons=[];this.buttons.push({callback:function(){c.$remoteOk.classList.contains(this.DISABLED)||(c.destroy(),c._execute.bind(c)())},text:"OK",isDefault:!0,id:"remoteOk"})};h.prototype._bindToDom=function(b){var c=this;this.$newBranch.addEventListener("input",function(b){c._validate()});this.$newBranch.placeholder=g["No remote selected"];
this.hideNewBranch&&(this.$newBranchPane.style.display="none")};h.prototype._beforeShowing=function(){this._initialize();this._loadRemoteChildren()};h.prototype._afterShowing=function(){this.$treeContentPane.focus();this._validate()};h.prototype._loadRemoteChildren=function(){var d=new b(this.gitClient,null,this.gitClient.getGitClone,this.treeRoot);this._createTree(d)};h.prototype._createTree=function(b){var c=this,h=this.serviceRegistry.getService("orion.remotePrompter.selection");h||(h=new e.Selection(this.serviceRegistry,
"orion.remotePrompter.selection"));var a=new d({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"});this.explorer=new k.Explorer(this.serviceRegistry,h,a);a.explorer=this.explorer;this.explorer.createTree("treeContentPane",b);h.addEventListener("selectionChanged",function(a){a.selection&&"Remote"===a.selection.Type?(c.$newBranch.disabled=!1,c.$newBranch.placeholder=g["Enter a name..."]):(c.$newBranch.disabled=!0,c.$newBranch.placeholder=g["No remote selected"]);c._validate(a.selection)})};
h.prototype._validate=function(b){var c=function(b){b&&"RemoteTrackingBranch"===b.Type?this.$remoteOk.classList.remove(this.DISABLED):b&&"Remote"===b.Type&&""!==this.$newBranch.value?this.$remoteOk.classList.remove(this.DISABLED):this.$remoteOk.classList.add(this.DISABLED)};b?c.bind(this)(b):this.serviceRegistry.getService("orion.remotePrompter.selection").getSelection(c.bind(this))};h.prototype._execute=function(){var b=this;this.serviceRegistry.getService("orion.remotePrompter.selection").getSelection(function(c){if(b.func)if("RemoteTrackingBranch"===
c.Type)b.func(c,c.parent);else{var d=c.CloneLocation.substring(c.CloneLocation.indexOf(c.CloneLocation.split("/")[3])),a={};a.parent=c;a.FullName="refs/remotes/"+c.Name+"/"+b.$newBranch.value;a.Name=c.Name+"/"+b.$newBranch.value;a.Type="RemoteTrackingBranch";a.Location="/gitapi/remote/"+c.Name+"/"+encodeURIComponent(encodeURIComponent(b.$newBranch.value))+"/"+d;b.func(null,c,a)}})};h.prototype.constructor=h;return{RemotePrompterDialog:h}});
define("orion/git/widgets/ReviewRequestDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv\x3e\x3cdiv id\x3d"treeContentPane" style\x3d"padding: 8px"\x3e\x3clabel for\x3d"reviewReqUrl"\x3e${Paste link in email or IM}\x3c/label\x3e\x3cbr\x3e\x3cinput id\x3d"reviewReqUrl" style\x3d"width: 50em" value\x3d""/\x3e\x3c/div\x3e\x3cdiv id\x3d"newBranchPane" style\x3d"padding: 8px"\x3e\x3clabel for\x3d"reviewerName"\x3e${Send the link to the reviewer}\x3c/label\x3e\x3cbr\x3e\x3cinput id\x3d"reviewerName" style\x3d"width: 30em"  value\x3d""/\x3e\x3c/div\x3e\x3c/div\x3e';
k.prototype._init=function(e){var d=this;this.title=e.title||g["Contribution Review Request"];this.modal=!0;this.messages=g;this.url=e.url;this.func=e.func;this.buttons=[];this.buttons.push({callback:function(){d.destroy();d.func(d.$reviewerName.value)},text:g.Submit});this._initialize()};k.prototype._bindToDom=function(e){this.$reviewReqUrl.value=this.url};k.prototype.constructor=k;return{ReviewRequestDialog:k}});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(g,l){var k;k=g.toUrl?(new URL(g.toUrl("workspace"),window.location.href)).href:(new URL("/",window.location.href)).href;return{makeRelative:function(e){if(!e)return e;var d=window.location.protocol+"//"+window.location.host;return 0===e.indexOf(d)?e.substring(d.length):e},isAtRoot:function(e){return!e?!1:"/workspace"===e?!0:0===(new URL(e,window.location.href)).href.indexOf(k)}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages orion/Deferred orion/webui/littlelib orion/i18nUtil orion/fileUtils orion/explorers/explorer orion/EventTarget orion/objects orion/util".split(" "),function(g,l,k,e,d,h,b,f,c){function m(a,b,c,d,f,e){this.registry=a;this.root=b;this.fileClient=c;this.idPrefix=d||"";this.excludeFiles=!!f;this.excludeFolders=!!e}function a(a){b.attach(this);this.registry=a.serviceRegistry;this.treeRoot=a.treeRoot;this.selection=a.selection;this.fileClient=
a.fileClient;this.excludeFiles=a.excludeFiles;this.excludeFolders=a.excludeFolders;this.navHandlerFactory=a.navHandlerFactory;this.parentId=a.parentId;this.renderer=a.rendererFactory(this);this.dragAndDrop=a.dragAndDrop;this.setFocus=a.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var c=a.modelEventDispatcher?a.modelEventDispatcher:new b;this.modelEventDispatcher=c;var d=this;this._modelListeners={};"copy copyMultiple create delete deleteMultiple import move moveMultiple".split(" ").forEach(function(a){c.addEventListener(a,
d._modelListeners[a]=d.modelHandler[a].bind(d))});this._clickListener=function(a){if("A"===a.target.tagName){for(a=a.target;a&&!a._item;)a=a.parentNode;if(a&&a._item)d.onLinkClick({type:"linkClick",item:a._item})}};(a=k.node(this.parentId))&&a.addEventListener("click",this._clickListener);var f=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";f.setTarget&&f.setTarget(a)}},
{pid:"nav.config"})}m.prototype=new h.ExplorerModel;f.mixin(m.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,b){var c=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var d=[],f;for(f in b)if(!(b[f].Directory?this.excludeFolders:this.excludeFiles))d.push(b[f]),b[f].parent=a,b[f].Parents||(b[f].Parents=c);b=d}else for(d in b)b[d].parent=a,b[d].Parents||(b[d].Parents=c);a.children=b;a.children.sort(function(a,b){var c=a.Directory;if(c!==b.Directory)return c?
-1:1;var c=a.Name&&a.Name.toLowerCase(),d=b.Name&&b.Name.toLowerCase();return c<d?-1:c>d?1:0});return b},getChildren:function(a,b){var c=this;if(a.children)b(a.children);else if(void 0!==a.Directory&&!1===a.Directory)b([]);else if(a.Children)b(c.processParent(a,a.Children));else if(a.Location){var d=null;this.registry&&(d=this.registry.getService("orion.page.progress"));(d?d.progress(this.fileClient.fetchChildren(a.ChildrenLocation),g["Fetching children of "]+a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(d){c.destroyed||
b(c.processParent(a,d))},function(){b([])})}else b([])},hasChildren:function(){var a=!1;this.root.Children&&(a=0<this.root.Children.length);return a}});m.prototype.constructor=m;var n,q;a.prototype=Object.create(h.Explorer.prototype);f.mixin(a.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});var b=k.node(this.parentId);b&&b.removeEventListener("click",this._clickListener);h.Explorer.prototype.destroy.call(this)},
onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var b=this,c={};(a.items||[a]).forEach(function(a){a=(a=a.parent)||b.treeRoot;c[a.Location]=a});return l.all(Object.keys(c).map(function(a){return b.changedItem(c[a],!0)}))},onModelMove:function(a){var b=this,c={};(a.items||[a]).forEach(function(a){var d=b.treeRoot;if((d.Location||d.ContentLocation)===a.oldValue.Location){var f=b.treeRoot;a=a.newValue;a=a.ChildrenLocation?
a:this.fileClient.read(a.ContentLocation,!0);return l.when(a,function(a){b.dispatchEvent({type:"rootMoved",oldValue:f,newValue:a});b.loadResourceList(a)})}d=(d=a.oldValue.parent)||b.treeRoot;c[d.Location]=d;d=(d=a.parent)||b.treeRoot;c[d.Location]=d;a.oldValue.Directory&&a.newValue&&b.isExpanded(a.oldValue)&&(c[a.newValue.Location]=a.newValue)});return l.all(Object.keys(c).map(function(a){return b.changedItem(c[a],!0)}))},onModelDelete:function(a){a=a.items||[a];var b=this,c=b.treeRoot,d;if(a.some(function(a){if(a.oldValue.Location===
(c.Location||c.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))d=a.parent;return!0}return!1}))return this.loadResourceList(d);var f={};a.forEach(function(a){a=a.parent;f[a.Location]=a});return l.all(Object.keys(f).map(function(a){return b.changedItem(f[a],!0)}))},modelHandler:{copy:function(a){if(!a.count)return this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},create:function(a){return this.onModelCreate(a)},"delete":function(a){if(!a.count)return this.onModelDelete(a)},
deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){if(!a.count)return this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},_makeDropTarget:function(a,b,f){if(this.dragAndDrop){var h=this,m=this.dragAndDrop,l=function(a){n=a.target};f&&(this._oldDragStart&&b.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=l);b.addEventListener("dragstart",l,!1);l=function(a){n=null};f&&
(this._oldDragEnd&&b.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=l);b.addEventListener("dragend",l,!1);l=function(a){b.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};f&&(this._oldDragLeave&&b.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=l);b.addEventListener("dragleave",l,!1);l=function(a){if(n)q=a.dataTransfer.dropEffect=(c.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!c.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===
a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect="copy";b.classList.add("dragOver");k.stop(a)};f&&(this._oldDragEnter&&b.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=l);b.addEventListener("dragenter",l,!1);l=function(a){if(n)q=a.dataTransfer.dropEffect=(c.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!c.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect=
"copy";k.stop(a)};f&&!this._oldDragOver&&(b.addEventListener("dragover",l,!1),this._oldDragOver=l);var z=null,A=null;h.registry&&(z=h.registry.getService("orion.page.progress"),A=h.registry.getService("orion.page.message"));var C=function(a){if(A){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;A.setProgressResult(b)}else window.console.log(a)},p=function(b,c,f,h,m,n,q){!f.Location&&f.fileMetadata&&(f=f.fileMetadata);c=c||"";if(b.isFile)d.isAtRoot(f.Location)?
C(g["You cannot copy files directly into the workspace.  Create a folder first."]):b.file(function(a){m(f,a,h,a.name.indexOf(".zip")===a.name.length-4&&window.confirm(e.formatMessage(g["Unzip ${0}?"],a.name)))});else if(b.isDirectory){var k=b.createReader(),l=function(a){k.readEntries(function(d){for(var f=0;f<d.length;f++)p(d[f],c+b.name+"/",a,h,m,n,!0)})};d.isAtRoot(f.Location)?(z?z.progress(n.createProject(f.ChildrenLocation,b.name),e.formatMessage(g["Creating ${0}"],b.name)):n.createProject(f.ChildrenLocation,
b.name)).then(function(a){h.loadResourceList(h.treeRoot.Path,!0);(z?z.progress(n.read(a.ContentLocation,!0),g["Loading "]+a.name):n.read(a.ContentLocation,!0)).then(function(a){l(a)},C)},C):(z?z.progress(n.createFolder(f.Location,b.name),e.formatMessage(g["Creating ${0}"],b.name)):n.createFolder(f.Location,b.name)).then(function(b){var c=h.modelEventDispatcher;q||c.dispatchEvent({type:"create",parent:a,newValue:b});l(b)},C)}},l=function(c){var f;b.classList.remove("dragOver");if(n){f=h.fileClient;
for(var B=n,D;B;){if(B._item){D=B._item;break}B=B.parentNode}if(!D)return;var l="copy"===q,B=l?f.copyFile:f.moveFile;(z?z.showWhile(B.apply(f,[D.Location,a.Location]),e.formatMessage(g[l?"Copying ${0}":"Moving ${0}"],D.Location)):B.apply(f,[D.Location,a.Location])).then(function(b){h.modelEventDispatcher.dispatchEvent({type:l?"copy":"move",oldValue:D,newValue:b,parent:a})},C)}else if(c.dataTransfer.items&&0<c.dataTransfer.items.length)for(f=0;f<c.dataTransfer.items.length;f++)B=null,"function"===
typeof c.dataTransfer.items[f].getAsEntry?B=c.dataTransfer.items[f].getAsEntry():"function"===typeof c.dataTransfer.items[f].webkitGetAsEntry&&(B=c.dataTransfer.items[f].webkitGetAsEntry()),B&&p(B,null,a,h,m,h.fileClient);else if(c.dataTransfer.files&&0<c.dataTransfer.files.length)for(f=0;f<c.dataTransfer.files.length;f++)B=c.dataTransfer.files[f],!B.size&&!B.type?C(e.formatMessage(g["Did not drop ${0}.  Folder drop is not supported in this browser."],B.name)):d.isAtRoot(a.Location)?C(g["You cannot copy files directly into the workspace.  Create a folder first."]):
m(a,B,h,B.name.indexOf(".zip")===B.name.length-4&&window.confirm(e.formatMessage(g["Unzip ${0}?"],B.name)));k.stop(c)};f&&(this._oldDrop&&b.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=l);b.addEventListener("drop",l,!1)}},createModel:function(){return new m(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var c=
this,d=new l;a.children=a.Children=null;this.model.getChildren(a,function(f){c.getNavHandler();c.myTree.refresh.bind(c.myTree)(a,f,b);d.resolve(f)});return d},showItem:function(a,b){var c=new l;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return c.reject();var d=this.getRow(a);if(d)c.resolve(d._item||a);else return a.Parents&&0<a.Parents.length?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],b).then(function(b){var c=this.getRow(a);
return!c?this.changedItem(b,!0).then(function(){var b=this.getRow(a);return b?b._item:(new l).reject()}.bind(this)):c._item||a}.bind(this))):void 0===b||b?this.reroot(a):c.reject();return c},expandItem:function(a,b){var c=new l;this.showItem(a,b).then(function(a){this.myTree.isExpanded(a)?c.resolve(a):this.myTree.expand(this.model.getId(a),function(){c.resolve(a)})}.bind(this),c.reject);return c},reveal:function(a,b){return this.showItem(a,b).then(function(a){var b=this.getNavHandler();b&&(b.cursorOn(a,
!0),b.setSelection(a));return a}.bind(this))},reroot:function(a){return(new l).reject()},isExpanded:function(a){a=this.model.getId(a);return this.renderer.tableTree.isExpanded(a)},getNameNode:function(a){if(a=this.model.getId(a))return k.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(a){},loadResourceList:function(a,b,c){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);a=d.makeRelative(a);if(!b&&a===this._lastPath)return(new l).resolve(this.treeRoot);this._lastPath=a;
var f=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),g["Loading "]+a).then(function(b){f.treeRoot.Path=a;"function"===typeof c&&c();f.dispatchEvent({type:"rootChanged",root:f.treeRoot});return(new l).resolve(f.treeRoot)},function(a){f.treeRoot.Path=null;f.dispatchEvent({type:"rootChanged",root:f.treeRoot});return(new l).reject(a)}):(new l).resolve(f.treeRoot)},load:function(a,b,c){var d=k.node(this.parentId),f=k.node("progress");f||(f=document.createElement("div"),
f.id="progress",k.empty(d),d.appendChild(f));k.empty(f);var e=setTimeout(function(){k.empty(f);f.appendChild(document.createTextNode(b))},500),h=this;return l.when(a,function(a){clearTimeout(e);if(!h.destroyed){h.treeRoot={};for(var b in a)h.treeRoot[b]=a[b];h.model=h.createModel();h.dragAndDrop&&(h._hookedDrag?h._makeDropTarget(h.treeRoot,d,!0):(a=(a=d&&("draggable"in d||"ondragstart"in d&&"ondrop"in d))&&!(!window.File||!window.FileList||!window.FileReader),h._hookedDrag=!0,a?h._makeDropTarget(h.treeRoot,
d,!0):(h.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))));var f=new l;h.createTree(h.parentId,h.model,{onComplete:function(a){f.resolve(a)},navHandlerFactory:h.navHandlerFactory,setFocus:"undefined"===typeof h.setFocus?!0:h.setFocus,selectionPolicy:h.renderer.selectionPolicy,onCollapse:function(a){if(h.getNavHandler())h.getNavHandler().onCollapse(a)}});return f.then(function(){if("function"===typeof c)try{c()}catch(a){h.registry&&h.registry.getService("orion.page.message").setErrorMessage(a)}if("function"===
typeof h.onchange)h.onchange(h.treeRoot);return h.treeRoot})}},function(a){clearTimeout(e);h.registry&&h.registry.getService("orion.page.message").setProgressResult(a);return(new l).reject(a)})},onchange:function(a){}});a.prototype.constructor=a;return{FileExplorer:a,FileModel:m}});
define("orion/webui/dialogs/DirectoryPrompterDialog","i18n!orion/widgets/nls/messages orion/webui/littlelib orion/webui/dialog orion/fileUtils orion/selection orion/explorers/navigationUtils orion/explorers/explorer orion/explorers/explorer-table".split(" "),function(g,l,k,e,d,h,b,f){function c(a,b){this.explorer=b;this._init(a)}function m(a){this._init(a)}c.prototype=new b.SelectionRenderer;c.prototype.constructor=c;c.prototype.getLabelColumnIndex=function(){return 0};c.prototype.getCellElement=
function(a,b,c){a=document.createElement("td");c.appendChild(a);var d=document.createElement("span");d.id=c.id+"navSpan";a.appendChild(d);d.className="mainNavColumn singleNavColumn";this.getExpandImage(c,d);d.appendChild(document.createTextNode(b.Name))};m.prototype=new k.Dialog;m.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"directoryTree" class\x3d"explorerTreeClass" style\x3d"width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"\x3e\x3c/div\x3e';
m.prototype._init=function(a){this.title=a.title||g["Choose a Folder"];this.modal=!0;this.buttons=[{text:g.OK,isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._fileClient=a.fileClient;this._serviceRegistry=a.serviceRegistry;this._message=a.message||"";this._func=a.func;this._initialize()};m.prototype._bindToDom=function(a){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
m.prototype.loadFolderList=function(a){a=e.makeRelative(a);this.selection=new d.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new f.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(a){return new c({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},a)}});this.explorer.loadResourceList(a,!0,null)};m.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};m.prototype.constructor=m;return{DirectoryPrompterDialog:m}});
define("orion/git/widgets/CloneGitRepositoryDialog",["i18n!git/nls/gitmessages","orion/webui/dialogs/DirectoryPrompterDialog","orion/webui/dialog","orion/URITemplate","require"],function(g,l,k,e,d){function h(b){this._init(b)}var b=new e("edit/edit.html#{,resource,params*}");h.prototype=new k.Dialog;h.prototype.TEMPLATE='\x3cspan id\x3d"basicPane"\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3clabel for\x3d"gitUrl"\x3e${Repository URL:}\x3c/label\x3e\x3cinput id\x3d"gitUrl" style\x3d"width: 50em" value\x3d""/\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 8px; text-align: right;"\x3e\x3ca id\x3d"advancedLink" href\x3d"javascript:"\x3e${Choose target location}\x3c/a\x3e\x3ca id\x3d"advancedLinkHide" href\x3d"javascript:" style\x3d"display: none"\x3e${Default target location}\x3c/a\x3e\x3c/div\x3e\x3c/span\x3e\x3cspan id\x3d"advancedPane" style\x3d"display: none;"\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3cinput id\x3d"isNewProject" type\x3d"radio" name\x3d"isNewProject" checked value\x3d"new"/\x3e\x3clabel for\x3d"gitName" style\x3d"padding: 0 8px"\x3e${New folder:}\x3c/label\x3e\x3cinput id\x3d"gitName" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3cinput id\x3d"isExistingProject" type\x3d"radio" name\x3d"isNewProject" value\x3d"existing"/\x3e\x3clabel for\x3d"gitPath" style\x3d"padding: 0 8px"\x3e${Existing directory:}\x3c/label\x3e\x3cinput id\x3d"gitPath" type\x3d"hidden" value\x3d""\x3e\x3cspan id\x3d"shownGitPath" style\x3d"padding-right: 24px"\x3e\x3c/span\x3e\x3ca id\x3d"changeGitPath" href\x3d"javascript:"\x3e${Change...}\x3c/a\x3e\x3c/div\x3e\x3c/span\x3e';h.prototype._init=
function(b){var c=this;this.title=b.title?b.title:g["Clone Git Repository"];this.modal=!0;this.messages=g;this.advancedShown=!1;this.alwaysShowAdvanced=b.alwaysShowAdvanced;this.advancedOnly=b.advancedOnly;this.url=b.url;this.serviceRegistry=b.serviceRegistry;this.fileClient=b.fileClient;this.func=b.func;this.buttons=[];this.buttons.push({callback:function(){c.destroy();c._execute()},text:"OK"});this._initialize()};h.prototype._bindToDom=function(b){var c=this;this.url&&(this.$gitUrl.value=this.url);
this.advancedOnly&&(this.$basicPane.style.display="none",this.$advancedPane.style.display="",setTimeout(function(){c.$gitName.focus()},400));this.$changeGitPath.addEventListener("click",function(b){c._openDirectoryPickerDialog()});this.$isExistingProject.addEventListener("click",function(b){c._checkNewExisting()});this.$isNewProject.addEventListener("click",function(b){c._checkNewExisting()});this.$gitName.addEventListener("focus",function(b){c._showNewProject()});this.$advancedLink.addEventListener("click",
function(b){c._showAdvanced()});this.$advancedLinkHide.addEventListener("click",function(b){c._hideAdvanced()});this.alwaysShowAdvanced&&this._showAdvanced()};h.prototype._execute=function(){this.func&&this.func(this.advancedOnly?void 0:this.$gitUrl.value,this.advancedShown&&this.$isNewProject.checked?void 0:this.$gitPath.value,this.advancedShown&&!this.$isNewProject.checked?void 0:this.$gitName.value)};h.prototype._showAdvanced=function(){this.advancedShown=!0;this.$advancedPane.style.display="";
this.$advancedLink.style.display="none";this.$advancedLinkHide.style.display=""};h.prototype._hideAdvanced=function(){this.advancedShown=!1;this.$advancedPane.style.display="none";this.$advancedLink.style.display="";this.$advancedLinkHide.style.display="none"};h.prototype._checkNewExisting=function(){this.$isExistingProject.checked?this._openDirectoryPickerDialog():this.$gitName.focus()};h.prototype._showNewProject=function(){this.$isNewProject.checked=!0};h.prototype._openDirectoryPickerDialog=function(){function f(a){var c=
document.createElement("a");c.href=d.toUrl(b.expand({resource:a.ChildrenLocation}));c.textContent=a.Name;return c}var c=this;this.$isExistingProject.checked=!0;var e=new l.DirectoryPrompterDialog({title:g["Choose a Folder"],serviceRegistry:this.serviceRegistry,fileClient:this.fileClient,func:function(a){if(a&&a.Location){for(c.$gitPath.value=a.Location;c.$shownGitPath.hasChildNodes();)c.$shownGitPath.removeChild(c.$shownGitPath.lastChild);for(c.$shownGitPath.appendChild(f(a));a.parent&&"/"!==a.parent.Location;)c.$shownGitPath.insertBefore(document.createTextNode("/"),
c.$shownGitPath.firstChild),c.$shownGitPath.insertBefore(f(a.parent),c.$shownGitPath.firstChild),a=a.parent}}});this._addChildDialog(e);e.show()};h.prototype.constructor=h;return{CloneGitRepositoryDialog:h}});
define("orion/git/widgets/GitCredentialsDialog",["i18n!git/nls/gitmessages","orion/git/gitPreferenceStorage","orion/webui/dialog","orion/git/util"],function(g,l,k,e){function d(d){this._init(d)}d.prototype=new k.Dialog;d.prototype.TEMPLATE='\x3cdiv id\x3d"gitCredentialsLabel" style\x3d"padding: 8px"\x3e${Repository URL:}\x3cstrong id\x3d"url"\x3e\x3c/strong\x3e\x3c/div\x3e\x3cdiv id\x3d"gitSshUsernameRow" style\x3d"padding: 8px"\x3e\x3clabel id\x3d"gitSshUsernameLabel" for\x3d"gitSshUsername"\x3e${Username:}\x3c/label\x3e\x3cinput id\x3d"gitSshUsername" value\x3d""\x3e\x3c/div\x3e\x3cdiv id\x3d"gitSshPasswordRow" style\x3d"padding: 8px"\x3e\x3cinput id\x3d"isSshPassword" type\x3d"radio" name\x3d"isSshPassword" checked value\x3d"password"/\x3e\x3clabel id\x3d"gitSshPasswordLabel" for\x3d"gitSshPassword" style\x3d"padding: 0 8px"\x3e${Password:}\x3c/label\x3e\x3cinput type\x3d"password" id\x3d"gitSshPassword" value\x3d"" style\x3d"width: 30em"\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3cdiv id\x3d"gitPrivateKeyRow"\x3e\x3cinput id\x3d"isPrivateKey" type\x3d"radio" name\x3d"isSshPassword" value\x3d"privateKey" style\x3d"vertical-align: top"/\x3e\x3clabel id\x3d"gitPrivateKeyLabel" for\x3d"gitPrivateKey" style\x3d"padding: 0 8px; vertical-align: top"\x3e${Private key:}\x3c/label\x3e\x3ctextarea id\x3d"gitPrivateKey" value\x3d""\x3e\x3c/textarea\x3e\x3c/div\x3e\x3cdiv id\x3d"gitPrivateKeyFileRow" style\x3d"padding-left: 8em"\x3e\x3clabel id\x3d"gitPrivateKeyFileLabel" for\x3d"gitPrivateKeyFile"\x3e${Private key file (optional):}\x3c/label\x3e\x3cbr\x3e\x3cinput id\x3d"gitPrivateKeyFile" multiple\x3d"false" type\x3d"file" size\x3d"53" label\x3d"Browse..."\x3e\x3c/div\x3e\x3cdiv id\x3d"gitPassphraseRow" style\x3d"padding-left: 8em"\x3e\x3clabel id\x3d"gitPassphraseLabel" for\x3d"gitPassphrase"\x3e${Passphrase (optional):}\x3c/label\x3e\x3cbr\x3e\x3cinput type\x3d"password" id\x3d"gitPassphrase" value\x3d"" style\x3d"width: 30em"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv id\x3d"gitSaveCredentialsRow" style\x3d"padding: 8px"\x3e\x3cimg id\x3d"gitSaveCredentialsInfo" src\x3d"/images/info.gif""\x3e\x3cinput id\x3d"gitSaveCredentials" type\x3d"checkbox" name\x3d"gitSaveCredentials"\x3e\x3clabel id\x3d"gitSaveCredentialsLabel" for\x3d"gitSaveCredentials"\x3e${Don\'t prompt me again:}\x3c/label\x3e\x3c/div\x3e';d.prototype._init=
function(d){var b=this;this.title=d.title||g["Git Credentials"];this.modal=!0;this.messages=g;this.options=d;!this.options.username&&!this.options.password&&!this.options.privatekey&&!this.options.passphrase&&(this.options.username=!0,this.options.password=!0,this.options.privatekey=!0,this.options.passphrase=!0);d.serviceRegistry&&(this._sshService=d.serviceRegistry.getService("orion.net.ssh"),this._progressService=d.serviceRegistry.getService("orion.page.progress"));this.buttons=[];this.buttons.push({callback:function(){b.destroy();
b._execute()},text:"OK",isDefault:!0});this._initialize()};d.prototype._bindToDom=function(d){var b=this;this.options.username||(this.$gitSshUsernameRow.style.display="none");this.options.password||(this.$gitSshPasswordRow.style.display="none");this.options.privatekey||(this.$gitPrivateKeyRow.style.display="none",this.$gitPrivateKeyFileRow.style.display="none");this.options.passphrase||(this.$gitPassphraseRow.style.display="none");this.options.errordata&&this.options.errordata.Url&&(this.$gitCredentialsLabel.style.display=
"block",this.$url.textContent=this.options.errordata.Url);this.options.errordata&&this.options.errordata.User&&""!==this.options.errordata.User&&(this.$gitSshUsername.value=this.options.errordata.User,this.$gitSshUsernameRow.style.display="none",setTimeout(function(){b.$gitSshPassword.focus()},400));(new l(this.options.serviceRegistry)).isEnabled().then(function(d){d||(b.$gitSaveCredentials.style.display="none",b.$gitSaveCredentialsLabel.style.display="none",b.$gitSaveCredentialsInfo.style.display=
"none")});this.$gitSshPassword.addEventListener("focus",function(d){b.$isSshPassword.checked=!0});this.$gitPrivateKey.addEventListener("focus",function(d){b.$isPrivateKey.checked=!0});this.$gitPrivateKeyFile.addEventListener("focus",function(d){b.$isPrivateKey.checked=!0});this.$gitPassphrase.addEventListener("focus",function(d){b.$isPrivateKey.checked=!0});this.$gitPrivateKeyFile.addEventListener("change",function(d){b.privateKeyFile=d.target.files[0]})};d.prototype._execute=function(){var d=this,
b=this.$gitPrivateKey.value,f=this.$url.textContent,c=function(a){if(d._sshService){var b=e.parseSshGitUrl(f);d._sshService.getKnownHostCredentials(b.host,b.port).then(function(b){if(d.options.func){var c="undefined"===typeof d.options.failedOperation?d.options.errordata.failedOperation:d.options.failedOperation;"undefined"!==c&&d._progressService.removeOperation(c);d.options.func({gitSshUsername:d.$gitSshUsername.value,gitSshPassword:d.$isSshPassword.checked?d.$gitSshPassword.value:"",gitPrivateKey:d.$isPrivateKey.checked?
a:"",gitPassphrase:d.$isPrivateKey.checked?d.$gitPassphrase.value:"",knownHosts:b})}})}else d.options.func&&(b="undefined"===typeof d.options.failedOperation?d.options.errordata.failedOperation:d.options.failedOperation,"undefined"!==b&&d._progressService.removeOperation(b),d.options.func({gitSshUsername:d.$gitSshUsername.value,gitSshPassword:d.$gitSshPassword.value,gitPrivateKey:a,gitPassphrase:d.$gitPassphrase.value,knownHosts:d.$gitSshKnownHosts.value}))};if(this.privateKeyFile){var g=new FileReader;
g.onload=function(a){return function(a){b=a.target.result;a=new l(d.options.serviceRegistry);d.$gitSaveCredentials.checked?a.put(f,{gitPrivateKey:b,gitPassphrase:d.$gitPassphrase.value}).then(function(){c(b)}):c(b)}}(this.privateKeyFile);g.readAsText(this.privateKeyFile)}else 0<b.length?(g=new l(d.options.serviceRegistry),d.$gitSaveCredentials.checked?g.put(f,{gitPrivateKey:b,gitPassphrase:d.$gitPassphrase.value}).then(function(){c(b)}):c(b)):(g=new l(d.options.serviceRegistry),d.$gitSaveCredentials.checked?
g.put(f,{gitSshUsername:d.$gitSshUsername.value,gitSshPassword:d.$gitSshPassword.value}).then(function(){c(b)}):c(b))};d.prototype.constructor=d;return{GitCredentialsDialog:d}});
define("orion/git/widgets/OpenCommitDialog","require i18n!git/nls/gitmessages orion/i18nUtil orion/Deferred orion/webui/dialog orion/URITemplate orion/webui/littlelib".split(" "),function(g,l,k,e,d,h,b){function f(b){this._init(b)}var c=new h("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1");f.prototype=new d.Dialog;f.prototype.TEMPLATE='\x3cdiv\x3e\x3clabel for\x3d"resourceName"\x3e${Type the commit name (sha1):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput type\x3d"text" id\x3d"resourceName"\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:400px; height:auto; overflow-y:auto;"\x3e\x3c/div\x3e';
f.prototype._init=function(b){this.title=b.title||l["Find Commit"];this.modal=!0;this.messages=l;this.SEARCH_DELAY=500;this.timeoutId=null;this.time=0;this.serviceRegistry=b.serviceRegistry;if(!this.serviceRegistry)throw Error("Missing required argument: serviceRegistry");this.repositories=b.repositories;if(!this.repositories)throw Error("Missing required argument: repositories");this.commitName=b.commitName;this._initialize()};f.prototype._bindToDom=function(c){var a=this;this.$resourceName.addEventListener("input",
function(b){a.time=+new Date;a.timeoutId&&clearTimeout(a.timeoutId);a.timeoutId=setTimeout(a._checkSearch.bind(a),0)},!1);this.$resourceName.addEventListener("keydown",function(c){if(c.keyCode===b.KEY.ENTER){var d=b.$("a",a.$results);d&&(b.stop(c),window.open(d.href),a.hide())}},!1);this.$resourceName.value=this.commitName};f.prototype._checkSearch=function(){clearTimeout(this.timeoutId);var b=(new Date).getTime();b-this.time>this.SEARCH_DELAY?(this.time=b,this._doSearch()):this.timeoutId=setTimeout(this._checkSearch.bind(this),
50)};f.prototype._findCommitLocation=function(b,a,c){var d=this;c||(c=new e);0<b.length?this.serviceRegistry.getService("orion.page.progress").progress(d.serviceRegistry.getService("orion.git.provider").doGitLog("/gitapi/commit/"+a+b[0].ContentLocation+"?page\x3d1\x26pageSize\x3d1"),"Getting commit details "+a).then(function(a){c.resolve(a.Children[0])},function(f){d._findCommitLocation(b.slice(1),a,c)}):c.reject();return c};f.prototype._doSearch=function(){var c=this,a=this.$resourceName&&this.$resourceName.value;
if(a){var d=document.createElement("div");d.appendChild(document.createTextNode(l["Searching..."]));b.empty(this.$results);this.$results.appendChild(d);this.serviceRegistry.getService("orion.page.message").setProgressMessage(l["Looking for the commit"]);this._findCommitLocation(this.repositories,a).then(function(a){b.empty(c.$results);c._displayCommit(a,c.$results);c.serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){a=document.createElement("div");a.appendChild(document.createTextNode("No commits found"));
b.empty(c.$results);c.$results.appendChild(a);c.serviceRegistry.getService("orion.page.message").setProgressMessage("")})}};f.prototype._displayCommit=function(d,a){var f=this,e=document.createElement("div");e.style.padding="10px";e.style.maxWidth="480px";b.empty(a);a.appendChild(e);var h=d.Message.split(/(\r?\n|$)/)[0],t=document.createElement("a");t.className="navlinkonpage";t.href=g.toUrl(c.expand({resource:d.Location}));t.textContent=h;e.appendChild(t);t.addEventListener("mouseup",function(a){0===
a.button&&!a.ctrlKey&&!a.metaKey&&f.hide()},!1);t.addEventListener("keyup",function(a){a.keyCode===b.KEY.ENTER&&f.hide()},!1);h=document.createElement("div");h.style.paddingTop="15px";e.appendChild(h);d.AuthorImage&&(e=new Image,e.src=d.AuthorImage,e.name=d.AuthorName,e.className="git-author-icon",h.appendChild(e));e=document.createElement("div");e.textContent=k.formatMessage(l[" authored by ${0} {${1}) on ${2}"],d.AuthorName,d.AuthorEmail,(new Date(d.Time)).toLocaleString());h.appendChild(e);e=document.createElement("div");
e.textContent=k.formatMessage(l["committed by 0 (1)"],d.CommitterName,d.CommitterEmail);h.appendChild(e);e=document.createElement("div");e.style.paddingTop="15px";e.textContent=l["commit:"]+d.Name;h.appendChild(e);d.Parents&&0<d.Parents.length&&(a=document.createElement("div"),a.textContent=l["parent:"],e=document.createElement("a"),e.className="navlinkonpage",e.href=g.toUrl(c.expand({resource:d.Parents[0].Location})),e.textContent=d.Parents[0].Name,a.appendChild(e),e.addEventListener("mouseup",function(a){0===
a.button&&!a.ctrlKey&&!a.metaKey&&f.hide()},!1),e.addEventListener("keyup",function(a){a.keyCode===b.KEY.ENTER&&f.hide()},!1),h.appendChild(a))};f.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};f.prototype.constructor=f;return{OpenCommitDialog:f}});
define("orion/git/widgets/CommitDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv style\x3d"display: none; padding-top: 10px; padding-bottom: 10px;" id\x3d"commitInfoBar"\x3e\x3cstrong id\x3d"commitInfo"\x3e\x3c/strong\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"commitMessageLabel" for\x3d"commitMessage"\x3e${Message:}\x3c/label\x3e\x3cinput id\x3d"commitMessage" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"amendLabel" for\x3d"amend"\x3e${Amend:}\x3c/label\x3e\x3cinput id\x3d"amend" type\x3d"checkbox"\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"changeIdLabel" for\x3d"changeId"\x3e${ChangeId:}\x3c/label\x3e\x3cinput id\x3d"changeId" type\x3d"checkbox"\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"committerNameLabel" for\x3d"committerName"\x3e${Committer Name:}\x3c/label\x3e\x3cinput id\x3d"committerName" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"committerEmailLabel" for\x3d"committerEmail"\x3e${Committer Email:}\x3c/label\x3e\x3cinput id\x3d"committerEmail" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"authorNameLabel" for\x3d"authorName"\x3e${Author Name:}\x3c/label\x3e\x3cinput id\x3d"authorName" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"authorEmailLabel" for\x3d"authorEmail"\x3e${Author Email:}\x3c/label\x3e\x3cinput id\x3d"authorEmail" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e';k.prototype._init=
function(e){var d=this;this.title=g["Commit Changes"];this.modal=!0;this.messages=g;this.options=e;this.buttons=[];this.buttons.push({callback:function(){d._execute()},text:"OK",id:"commitChangesButton"});this._initialize()};k.prototype._bindToDom=function(e){var d=this;this.options.body.Message&&(this.$commitMessage.value=this.options.body.Message);this.$commitMessage.addEventListener("keyup",function(e){d._validate()});this.options.body.Amend&&(this.$amend.checked=!0);this.options.body.ChangeId&&
(this.$changeId.checked=!0);this.options.body.CommitterName&&(this.$committerName.value=this.options.body.CommitterName);this.$committerName.addEventListener("keyup",function(e){d._validate()});this.options.body.CommitterEmail&&(this.$committerEmail.value=this.options.body.CommitterEmail);this.$committerEmail.addEventListener("keyup",function(e){d._validate()});this.options.body.AuthorName&&(this.$authorName.value=this.options.body.AuthorName);this.$authorName.addEventListener("keyup",function(e){d._validate()});
this.options.body.AuthorEmail&&(this.$authorEmail.value=this.options.body.AuthorEmail);this.$authorEmail.addEventListener("keyup",function(e){d._validate()});this._validate()};k.prototype._validate=function(){this.$commitMessage.value?this.$committerName.value?this.$committerEmail.value?this.$authorName.value?this.$authorEmail.value?(this.$commitInfoBar.style.display="none",this.$commitChangesButton.classList.remove(this.DISABLED)):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),
this.$commitInfo.textContent=g["The author mail is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=g["The author name is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=g["The committer mail is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=
g["The committer name is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=g["The commit message is required."])};k.prototype._execute=function(){if(!this.$commitChangesButton.classList.contains(this.DISABLED)){if(this.options.func){var e={};e.Message=this.$commitMessage.value;e.Amend=this.$amend.checked?!0:!1;e.ChangeId=this.$changeId.checked?!0:!1;e.CommitterName=this.$committerName.value;e.CommitterEmail=
this.$committerEmail.value;e.AuthorName=this.$authorName.value;e.AuthorEmail=this.$authorEmail.value;this.options.func(e)}this.hide()}};k.prototype.constructor=k;return{CommitDialog:k}});
define("orion/git/widgets/ApplyPatchDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv style\x3d"padding:4px"\x3e\x3cinput type\x3d"radio" name\x3d"radio" value\x3d"urlRadio" id\x3d"urlRadio" checked/\x3e'+g["URL:"]+'\x3cinput type\x3d"text" name\x3d"url" id\x3d"url"/\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3cinput type\x3d"radio" name\x3d"radio" value\x3d"fileRadio" id\x3d"fileRadio"/\x3e'+
g["File:"]+'\x3cinput type\x3d"file" name\x3d"selectedFile" id\x3d"selectedFile" class\x3d"uploadChooser" /\x3e\x3c/div\x3e';k.prototype._init=function(e){var d=this;this.title=g["Apply Patch"];this.modal=!0;this.messages=g;this.options=e;this.buttons=[];this.buttons.push({callback:function(){d._applyPatch()},text:g.OK});this._initialize()};k.prototype._bindToDom=function(e){this.$selectedFile.onchange=function(d){this.$urlRadio.checked=!1;this.$fileRadio.checked="fileRadio"}.bind(this);this.$url.onchange=
function(d){this.$urlRadio.checked="urlRadio";this.$fileRadio.checked=!1}.bind(this)};k.prototype._applyPatch=function(e){e=new FormData;e.append("uploadedfile",this.$selectedFile.files[0]);e.append("url",this.$url.value);e.append("radio",this.$fileRadio.checked?"fileRadio":"urlRadio");this.req=new XMLHttpRequest;this.req.open("post",this.options.diffLocation);this.req.setRequestHeader("Orion-Version","1");this.req.onreadystatechange=this.handleReadyState.bind(this);this.req.send(e)};k.prototype.handleReadyState=
function(e){4===this.req.readyState&&(200===this.req.status?this.options.deferred&&this.options.deferred.resolve(this.req.responseText):this.options.deferred&&this.options.deferred.reject(this.req.responseText),this.hide())};k.prototype.constructor=k;return{ApplyPatchDialog:k}});
define("orion/git/gitCommands","i18n!git/nls/gitmessages require orion/Deferred orion/i18nUtil orion/webui/littlelib orion/commands orion/commandRegistry orion/git/util orion/compare/compareUtils orion/git/gitPreferenceStorage orion/git/gitConfigPreference orion/git/widgets/ConfirmPushDialog orion/git/widgets/RemotePrompterDialog orion/git/widgets/ReviewRequestDialog orion/git/widgets/CloneGitRepositoryDialog orion/git/widgets/GitCredentialsDialog orion/git/widgets/OpenCommitDialog orion/git/widgets/CommitDialog orion/git/widgets/ApplyPatchDialog orion/URL-shim orion/PageLinks orion/URITemplate".split(" "),function(g,
l,k,e,d,h,b,f,c,m,a,n,q,s,t,y,u,v,x,z,A,C){var p={};(function(){function w(a){return l.toUrl(z.expand({resource:a}))}function r(a){var b;try{b=JSON.parse(a.responseText)}catch(c){b={Message:g["Problem while performing the action"]}}b.HttpCode=a.status;return b}var B=!1,D=new C("git/git-repository.html#{,resource,params*}"),I=new C("git/git-log.html#{,resource,params*}?page\x3d1"),F=new C("git/git-log.html#{,resource,params*}"),J=new C("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1"),
z=new C(f.statusUILocation+"#{,resource,params*}"),G=new C("edit/edit.html#{,resource,params*}");p.updateNavTools=function(a,b,c,p,f,e,r){var h=d.node(p);if(h)b.destroy(h);else throw"could not find toolbar "+p;b.renderCommands(p,h,e,c,"button");if(r&&(p=d.node(r)))b.destroy(p),b.renderCommands(r,p,e,c,"button");if(f&&(e=d.node(f)))b.destroy(f),b.renderCommands(f,e,null,c,"button");B||(B=!0,a.getService("orion.page.selection").addEventListener("selectionChanged",function(a){var p=d.node(f);p&&(b.destroy(p),
b.renderCommands(f,p,a.selections,c,"button"))}))};p.handleKnownHostsError=function(a,b,c,d){if(confirm(e.formatMessage(g["Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}."],b.KeyType,b.Host,b.HostFingerprint))){var p=f.parseSshGitUrl(b.Url);b={host:b.Host,keyType:b.KeyType,hostKey:b.HostKey,port:p.port};a.getService("orion.net.ssh").addKnownHost(b).then(function(b){c.knownHosts=b;"undefined"!==typeof c.failedOperation&&a.getService("orion.page.progress").removeOperation(c.failedOperation);
d(c)})}};p.handleSshAuthenticationError=function(a,b,c,d,p){b=b?b.Url:void 0;var f=function(){(new y.GitCredentialsDialog({title:p,serviceRegistry:a,func:d,errordata:c.errordata,failedOperation:c.failedOperation})).show()};c.gitSshUsername&&""!==c.gitSshUsername||c.gitSshPassword&&""!==c.gitSshPassword||c.gitPrivateKey&&""!==c.gitPrivateKey?f():(new m(a)).get(b).then(function(b){""!==b.gitPrivateKey||""!==b.gitSshUsername||""!==b.gitSshPassword?("undefined"!==typeof c.failedOperation&&a.getService("orion.page.progress").removeOperation(c.failedOperation),
d({knownHosts:c.knownHosts,gitSshUsername:b.gitSshUsername,gitSshPassword:b.gitSshPassword,gitPrivateKey:b.gitPrivateKey,gitPassphrase:b.gitPassphrase})):f()},f)};p.getDefaultSshOptions=function(a,b,c){var d=new k;a=a.getService("orion.net.ssh");var p=c&&!c.optionsRequested?c.valueFor("sshuser"):"",e=c&&!c.optionsRequested?c.valueFor("sshpassword"):"",r;void 0!==b.GitUrl?r=b.GitUrl:void 0!==b.errorData?r=b.errorData.Url:void 0!==b.toRef?r=b.toRef.RemoteLocation[0].GitUrl:void 0!==b.RemoteLocation&&
(r=b.RemoteLocation[0].GitUrl);if(!r)return d.resolve({knownHosts:"",gitSshUsername:p,gitSshPassword:e,gitPrivateKey:"",gitPassphrase:""}),d;b=f.parseSshGitUrl(r);a.getKnownHostCredentials(b.host,b.port).then(function(a){d.resolve({knownHosts:a,gitSshUsername:p,gitSshPassword:e,gitPrivateKey:"",gitPassphrase:""})});return d};p.handleProgressServiceResponse=function(a,b,c,d,f,e){a&&void 0!==a.status&&(a=r(a));if(!a||void 0===a.HttpCode)d&&d(a);else switch(a.HttpCode){case 401:a.JsonData&&(b.errordata=
a.JsonData);a.failedOperation&&(b.failedOperation=a.failedOperation);p.handleSshAuthenticationError(c,a.JsonData,b,f,e);break;case 400:if(a.JsonData&&a.JsonData.HostKey){a.failedOperation&&(b.failedOperation=a.failedOperation);p.handleKnownHostsError(c,a.JsonData,b,f);break}else if(a.JsonData&&a.JsonData.Host){a.JsonData&&(b.errordata=a.JsonData);a.failedOperation&&(b.failedOperation=a.failedOperation);p.handleSshAuthenticationError(c,a.JsonData,b,f,e);break}default:b=[],b.Severity="Error",b.HTML=
!1,b.Message=a.DetailedMessage?a.DetailedMessage:a.Message,c.getService("orion.page.message").setProgressResult(b),d&&d(a)}};p.gatherSshCredentials=function(a,b,c){var d=new k,p;void 0!==b.items.RemoteLocation?p=b.items.RemoteLocation[0].GitUrl:void 0!==b.items.GitUrl?p=b.items.GitUrl:void 0!==b.items.errorData?p=b.items.errorData.Url:void 0!==b.items.toRef&&(p=b.items.toRef.RemoteLocation[0].GitUrl);var r=a.getService("orion.net.ssh"),h=f.parseSshGitUrl(p),w=function(c){a.getService("orion.net.ssh").getKnownHostCredentials(h.host,
h.port).then(function(a){b.sshObject=c;d.resolve({knownHosts:a,gitSshUsername:c.gitSshUsername,gitSshPassword:c.gitSshPassword,gitPrivateKey:c.gitPrivateKey,gitPassphrase:c.gitPassphrase})})},n=b.errorData;if(n&&n.HostKey){if(confirm(e.formatMessage(g["Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}."],n.KeyType,n.Host,n.HostFingerprint))){var B=f.parseSshGitUrl(n.Url);r.addKnownHost({host:n.Host,keyType:n.KeyType,hostKey:n.HostKey,port:B.port}).then(function(){b.sshObject&&
(""!==b.sshObject.gitSshUsername||""!==b.sshObject.gitSshPassword||""!==b.sshObject.gitPrivateKey)?w({gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""}):(new m(a)).get(p).then(function(a){w(a)},function(){w({gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""})})})}return d}var q=function(){if(!b.parameters&&!b.optionsRequested)w({gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""});else if(b.parameters&&!b.optionsRequested){var d=b.parameters&&
b.parameters.valueFor("sshuser")?b.parameters.valueFor("sshuser"):b.errorData.User,f=b.parameters?b.parameters.valueFor("sshpassword"):"",e=b.parameters&&b.parameters.valueFor("saveCredentials")?b.parameters.valueFor("saveCredentials"):!1,r=new m(a);e?r.put(p,{gitSshUsername:d,gitSshPassword:f}).then(function(){w({gitSshUsername:d,gitSshPassword:f,gitPrivateKey:"",gitPassphrase:""})}):w({gitSshUsername:d,gitSshPassword:f,gitPrivateKey:"",gitPassphrase:""})}else(new y.GitCredentialsDialog({title:c,
serviceRegistry:a,func:w,errordata:n})).show()};b.sshObject&&(""!==b.sshObject.gitSshUsername||""!==b.sshObject.gitSshPassword||""!==b.sshObject.gitPrivateKey)?q():(new m(a)).get(p).then(function(a){""!==a.gitPrivateKey||""!==a.gitSshUsername||""!==a.gitSshPassword?w(a):q()},q);return d};p.handleGitServiceResponse=function(a,b,c,d){a&&void 0!==a.status&&(a=r(a));if(!a||!a.HttpCode)c&&c(a);else switch(a.HttpCode){case 401:d(a);break;case 400:if(a.JsonData&&a.JsonData.HostKey){d(a);break}default:d=
[],d.Severity="Error",d.HTML=!1,d.Message=a.DetailedMessage?a.DetailedMessage:a.Message,b.getService("orion.page.message").setProgressResult(d),c&&c(a)}};p.createFileCommands=function(a,d,f,r){function B(b){var c={Severity:"Error",HTML:!1};try{var d=JSON.parse(b.responseText);401===b.status?(c.HTML=!0,c.Message="\x3cspan\x3e",c.Message+=e.formatMessage(g["Authentication required for: ${0}. ${1} and re-try the request."],d.label,'\x3ca target\x3d"_blank" href\x3d"'+d.SignInLocation+'"\x3e'+g.Login+
"\x3c/a\x3e")+"\x3c/span\x3e"):c.Message=d.DetailedMessage?d.DetailedMessage:d.Message?d.Message:g["Problem while performing the action"]}catch(f){c.Message=g["Problem while performing the action"]}a.getService("orion.page.message").setProgressResult(c)}r=new b.ParametersDescription([new b.CommandParameter("name","text",g["Local Branch Name:"])]);r=new h.Command({name:g.Checkout,tooltip:g["Checkout the current tag, creating a local branch based on its contents."],imageClass:"git-sprite-checkout",
spriteClass:"gitCommandSprite",id:"eclipse.checkoutTag",parameters:r,callback:function(b){var c=b.items,d=function(b,c,d){a.getService("orion.page.progress").showWhile(a.getService("orion.git.provider").checkoutTag(b,c,d),e.formatMessage(g["Checking out tag ${0}"],d)).then(function(){f.changedItem()},B)},p=c.Repository?c.Repository.Location:c.CloneLocation;b.parameters.valueFor("name")&&!b.parameters.optionsRequested&&d(p,c.Name,b.parameters.valueFor("name"))},visibleWhen:function(a){return"Tag"===
a.Type}});d.addCommand(r);r=new h.Command({name:g.Checkout,tooltip:g["Checkout the branch or corresponding local branch and make it active. If the remote tracking branch does not have a corresponding local branch, the local branch will be created first."],imageClass:"git-sprite-checkout",spriteClass:"gitCommandSprite",id:"eclipse.checkoutBranch",callback:function(b){var c=b.items,d=a.getService("orion.git.provider"),p=a.getService("orion.page.message"),r=a.getService("orion.page.progress");p.setProgressMessage(c.Name?
e.formatMessage(g["Checking out branch ${0}..."],c.Name):g["Checking out branch..."]);"Branch"===c.Type?r.progress(d.checkoutBranch(c.CloneLocation,c.Name),"Checking out branch "+c.Name).then(function(){p.setProgressResult(g["Branch checked out."]);f.changedItem(c.parent)},function(a){B(a)}):r.progress(d.addBranch(c.Repository?c.Repository.BranchLocation:c.parent.parent.BranchLocation,null,c.Name),"Adding branch "+c.Name).then(function(a){r.progress(d.checkoutBranch(a.CloneLocation,a.Name),"Checking out branch "+
c.Name).then(function(){p.setProgressResult(g["Branch checked out."]);f.changedItem(c.Repository?c.Repository.BranchLocation:c.parent.parent.parent)},function(a){B(a)})},function(a){B(a)})},visibleWhen:function(a){return"Branch"===a.Type||"RemoteTrackingBranch"===a.Type}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("name","text","Name:")]);r=new h.Command({name:g["New Branch"],tooltip:g["Add a new local branch to the repository"],id:"eclipse.addBranch",parameters:r,callback:function(b){var c=
b.items,d=a.getService("orion.page.progress"),p=function(b,p){d.progress(a.getService("orion.git.provider").addBranch(b,p),"Adding branch "+p).then(function(){f.changedItem(c)},B)},e;e="Clone"===c.Type?c.BranchLocation:c.Location;b.parameters.valueFor("name")&&!b.parameters.optionsRequested&&p(e,b.parameters.valueFor("name"))},visibleWhen:function(a){return a.GroupNode&&"Branches"===a.Name||"Clone"===a.Type&&"artifacts"===f.parentId}});d.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the local branch from the repository"],
imageClass:"core-sprite-delete",id:"eclipse.removeBranch",callback:function(b){var c=b.items;b=a.getService("orion.page.progress");confirm(e.formatMessage(g["Are you sure you want to delete branch ${0}?"],c.Name))&&b.progress(a.getService("orion.git.provider").removeBranch(c.Location),"Removing branch "+c.Name).then(function(){f.changedItem?f.changedItem(c.parent):f.displayBranches&&f.displayBranches(c.ParentLocation,null)},B)},visibleWhen:function(a){return"Branch"===a.Type&&!a.Current}});d.addCommand(r);
r=new h.Command({name:g.Delete,tooltip:g["Delete the remote tracking branch from the repository"],imageClass:"core-sprite-delete",id:"eclipse.removeRemoteBranch",callback:function(b){var c=b.items,d=a.getService("orion.page.progress");confirm(e.formatMessage(g["You're going to delete remote branch ${0} and push the change."],c.Name)+"\n\n"+g["Are you sure?"])&&p.getDefaultSshOptions(a,c).then(function(b){var e=arguments.callee,r=a.getService("orion.git.provider"),h=a.getService("orion.page.message"),
r=d.progress(r.doPush(c.Location,"",!1,!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Removing remote branch: "]+c.Name);h.createProgressMonitor(r,g["Removing remote branch: "]+c.Name);r.then(function(d){p.handleProgressServiceResponse(d,b,a,function(a){"Ok"==a.Result.Severity&&f.changedItem(c.parent)},e,g["Delete Remote Branch"])},function(d,f){p.handleProgressServiceResponse(d,b,a,function(){},e,g["Removing remote branch: "]+c.Name)})})},visibleWhen:function(a){return"RemoteTrackingBranch"===
a.Type}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("name","text","Name:"),new b.CommandParameter("url","url","Url:")]);r=new h.Command({name:g["New Remote"],tooltip:g["Add a new remote to the repository"],id:"eclipse.addRemote",parameters:r,callback:function(b){var c=b.items,d=a.getService("orion.page.progress"),p=function(b,p,e){d.progress(a.getService("orion.git.provider").addRemote(b,p,e),"Adding remote "+b).then(function(){f.changedItem(c)},B)},e;e="Clone"===c.Type?
c.RemoteLocation:c.Location;b.parameters.valueFor("name")&&b.parameters.valueFor("url")&&p(e,b.parameters.valueFor("name"),b.parameters.valueFor("url"))},visibleWhen:function(a){return a.GroupNode&&"Remotes"===a.Name||"Clone"===a.Type&&"artifacts"===f.parentId}});d.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the remote from the repository"],imageClass:"core-sprite-delete",id:"eclipse.removeRemote",callback:function(b){var c=b.items;confirm(e.formatMessage(g["Are you sure you want to delete remote ${0}?"],
c.Name))&&a.getService("orion.page.progress").progress(a.getService("orion.git.provider").removeRemote(c.Location),"Removing remote "+c.Name).then(function(){f.changedItem(c.parent)},B)},visibleWhen:function(a){return"Remote"===a.Type}});d.addCommand(r);r=new h.Command({name:g.Pull,tooltip:g["Pull from the repository"],imageClass:"git-sprite-pull",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pull",callback:function(b){var c=b.items,d=c.Location,e=c.Name;p.getDefaultSshOptions(a,c).then(function(b){var r=
arguments.callee,h=a.getService("orion.git.provider"),w=a.getService("orion.page.message"),h=a.getService("orion.page.progress").progress(h.doPull(d,!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pulling: "]+e);w.createProgressMonitor(h,g["Pulling: "]+e);var m;h.then(function(d){p.handleProgressServiceResponse(d,b,a,function(a){"Clone"===c.Type&&f.changedItem(c)},r,"Pull Git Repository")},function(d,e){m&&(d.failedOperation=m);p.handleProgressServiceResponse(d,
b,a,function(){f.changedItem(c)},r,g["Pull Git Repository"])},function(a){m=a.Location})})},visibleWhen:function(a){return"Clone"===a.Type}});d.addCommand(r);r=new h.Command({name:g["Git Log"],tooltip:g["Open the log for the branch"],id:"eclipse.openGitLog",hrefCallback:function(a){return l.toUrl(I.expand({resource:a.items.CommitLocation}))},visibleWhen:function(a){return"Branch"===a.Type||"RemoteTrackingBranch"===a.Type}});d.addCommand(r);r=new h.Command({name:g["Git Log"],tooltip:g["Open the log for the repository"],
id:"eclipse.openGitLogAll",imageClass:"git-sprite-log",spriteClass:"gitCommandSprite",hrefCallback:function(a){return l.toUrl(I.expand({resource:a.items.CommitLocation}))},visibleWhen:function(a){return!a.CommitLocation||!a.StatusLocation?!1:!0}});d.addCommand(r);r=new h.Command({name:g["Git Status"],tooltip:g["Open the status for the repository"],id:"eclipse.openGitStatus",hrefCallback:function(a){return w(a.items.StatusLocation)},visibleWhen:function(a){return!a.StatusLocation?!1:!0}});d.addCommand(r);
r=new h.Command({name:g.ShowInEditor,tooltip:g.ShowInEditorTooltip,id:"eclipse.openCloneContent",hrefCallback:function(a){return l.toUrl(G.expand({resource:a.items.ContentLocation}))},visibleWhen:function(a){return!a.ContentLocation?!1:!0}});d.addCommand(r);r=new h.Command({name:g["Compare With Each Other"],id:"eclipse.compareGitCommits",hrefCallback:function(b){b=b.items;return a.getService("orion.page.progress").progress(a.getService("orion.git.provider").getDiff(b[1].DiffLocation,b[0].Name),"Generating Diff for "+
b[0].Name+" and "+b[1].Name).then(function(a){return c.generateCompareHref(a.Location,{readonly:!0})})},visibleWhen:function(a){return f.isDirectory?!1:Array.isArray(a)&&2===a.length&&"Commit"===a[0].Type&&"Commit"===a[1].Type?!0:!1}});d.addCommand(r);r=new h.Command({name:g["Compare With Working Tree"],imageClass:"git-sprite-compare",spriteClass:"gitCommandSprite",id:"eclipse.compareWithWorkingTree",hrefCallback:function(a){return c.generateCompareHref(a.items.DiffLocation,{})},visibleWhen:function(a){return"Commit"===
a.Type&&null!==a.ContentLocation&&!f.isDirectory}});d.addCommand(r);r=new h.Command({name:g.Open,id:"eclipse.openGitCommit",imageClass:"git-sprite-open",spriteClass:"gitCommandSprite",hrefCallback:function(a){return l.toUrl(G.expand({resource:a.items.ContentLocation}))},visibleWhen:function(a){return"Commit"===a.Type&&null!=a.ContentLocation&&!f.isDirectory}});d.addCommand(r);r=new h.Command({name:g.Fetch,tooltip:g["Fetch from the remote"],imageClass:"git-sprite-fetch",spriteClass:"gitCommandSprite",
id:"eclipse.orion.git.fetch",callback:function(c){var e=c.items,r=e.Location,h=e.Name,w=function(c,f){c.JsonData.HostKey?(f.parameters=null,f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),
new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):
new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=c.JsonData;f.errorData.failedOperation=c.failedOperation;d.collectParameters(f)})},n=function(){c.parameters&&c.parameters.optionsRequested?(c.parameters=null,c.optionsRequested=!0,d.collectParameters(c)):(c.errorData&&c.errorData.failedOperation&&a.getService("orion.page.progress").removeOperation(c.errorData.failedOperation),
p.gatherSshCredentials(a,c).then(function(b){var d=a.getService("orion.git.provider"),m=a.getService("orion.page.message");b=a.getService("orion.page.progress").progress(d.doFetch(r,!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Fetching remote: "]+h);m.createProgressMonitor(b,g["Fetching remote: "]+h);b.then(function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem(e)},function(a){w(a,c)})},function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem(e)},
function(a){w(a,c)})})}))};if(c.items.GitUrl)n();else{var q=a.getService("orion.git.provider"),k=a.getService("orion.page.progress");k.progress(q.getGitRemote(r),"Getting remote details "+h).then(function(a){k.progress(q.getGitClone(a.CloneLocation),"Getting git repository information "+a.Name).then(function(a){c.items.GitUrl=a.Children[0].GitUrl;n()},B)},B)}},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||"Remote"===a.Type||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?
!0:!1}});d.addCommand(r);r=new h.Command({name:g["Force Fetch"],imageClass:"git-sprite-fetch",spriteClass:"gitCommandSprite",tooltip:g["Fetch from the remote branch into your remote tracking branch overriding its current content"],id:"eclipse.orion.git.fetchForce",callback:function(c){if(confirm(g["You're going to override content of the remote tracking branch. This can cause the branch to lose commits."]+"\n\n"+g["Are you sure?"])){var e=c.items,r=e.Location,h=e.Name,w=function(c,f){c.JsonData.HostKey?
(f.parameters=null,f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser",
"text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});
f.errorData=c.JsonData;f.errorData.failedOperation=c.failedOperation;d.collectParameters(f)})},n=function(){c.parameters&&c.parameters.optionsRequested?(c.parameters=null,c.optionsRequested=!0,d.collectParameters(c)):(c.errorData&&c.errorData.failedOperation&&a.getService("orion.page.progress").removeOperation(c.errorData.failedOperation),p.gatherSshCredentials(a,c).then(function(b){var d=a.getService("orion.git.provider"),m=a.getService("orion.page.progress"),n=a.getService("orion.page.message");
b=m.progress(d.doFetch(r,!0,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Fetching remote: "]+h);n.createProgressMonitor(b,g["Fetching remote: "]+h);b.then(function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem(e)},function(a){w(a,c)})},function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem(e)},function(a){w(a,c)})})}))};if(c.items.GitUrl)n();else{var B=a.getService("orion.git.provider");B.getGitRemote(r).then(function(a){B.getGitClone(a.CloneLocation).then(function(a){c.items.GitUrl=
a.Children[0].GitUrl;n()})})}}},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||"Remote"===a.Type||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?!0:!1}});d.addCommand(r);r=new h.Command({name:g.Merge,tooltip:g["Merge the content from the branch to your active branch"],imageClass:"git-sprite-merge",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.merge",callback:function(b){var c=b.items;b=a.getService("orion.git.provider");var d=a.getService("orion.page.progress"),
p=a.getService("orion.page.message");d.progress(b.doMerge(c.HeadLocation,c.Name,!1),"Merging "+c.Name).then(function(a){var b={};if("FAST_FORWARD"===a.Result||"ALREADY_UP_TO_DATE"===a.Result)b.Severity="Ok",b.HTML=!1,b.Message=a.Result;else if(a.Result){var d=c.HeadLocation.replace("commit/HEAD","status");b.Severity="Warning";b.HTML=!0;b.Message="\x3cspan\x3e"+a.Result;if(a.FailingPaths){var r="",h=!0,m;for(m in a.FailingPaths)h||(r+=", "),h=!1,r+=m;h||(b.Severity="Error",b.Message+=". "+e.formatMessage(g["Failing paths: ${0}"],
r))}b.Message+=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(d)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e"}else a.error&&(d=c.HeadLocation.replace("commit/HEAD","status"),b.Severity="Error",a.error.responseText&&JSON.parse(a.error.responseText)?(a=JSON.parse(a.error.responseText),b.Message=a.DetailedMessage?a.DetailedMessage:a.Message):b.Message=a.error.message,b.HTML=!0,b.Message="\x3cspan\x3e"+b.Message+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(d)+'"\x3e'+g["Git Status page"]+
"\x3c/a\x3e")+"\x3c/span\x3e");p.setProgressResult(b);f.changedItem(c)},function(b,d){var p=[],r=c.HeadLocation.replace("commit/HEAD","status");p.Severity="Error";p.HTML=!0;p.Message="\x3cspan\x3e"+JSON.stringify(d.xhr.responseText).DetailedMessage+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(r)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e";a.getService("orion.page.message").setProgressResult(p);f.changedItem(c)})},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||
"Branch"===a.Type&&!a.Current||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?!0:!1}});d.addCommand(r);r=new h.Command({name:g["Merge Squash"],tooltip:g["Squash the content of the branch to the index"],imageClass:"git-sprite-merge-squash",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.mergeSquash",callback:function(b){var c=b.items;b=a.getService("orion.git.provider");var d=a.getService("orion.page.progress"),p=a.getService("orion.page.message");d.progress(b.doMerge(c.HeadLocation,
c.Name,!0),"Merging "+c.Name).then(function(a){var b=[];if("FAST_FORWARD_SQUASHED"===a.Result||"ALREADY_UP_TO_DATE"===a.Result)b.Severity="Ok",b.HTML=!1,b.Message=a.Result;else if(a.Result){var d=c.HeadLocation.replace("commit/HEAD","status");b.Severity="Warning";b.HTML=!0;b.Message="\x3cspan\x3e"+a.Result+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(d)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e"}else a.error&&(d=c.HeadLocation.replace("commit/HEAD","status"),b.Severity="Error",
a.error.responseText&&JSON.parse(a.error.responseText)?(a=JSON.parse(a.error.responseText),b.Message=a.DetailedMessage?a.DetailedMessage:a.Message):b.Message=a.error.message,b.HTML=!0,b.Message="\x3cspan\x3e"+b.Message+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(d)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e");p.setProgressResult(b);f.changedItem(c)},function(b,d){var p=[],r=c.HeadLocation.replace("commit/HEAD","status");p.Severity="Error";p.HTML=!0;p.Message="\x3cspan\x3e"+
JSON.stringify(d.xhr.responseText).DetailedMessage+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(r)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e";a.getService("orion.page.message").setProgressResult(p);f.changedItem(c)})},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||"Branch"===a.Type&&!a.Current||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?!0:!1}});d.addCommand(r);r=new h.Command({name:g.Rebase,tooltip:g["Rebase your commits by removing them from the active branch, starting the active branch again based on the latest state of the selected branch "]+
"and applying each commit again to the updated active branch.",id:"eclipse.orion.git.rebase",imageClass:"git-sprite-rebase",spriteClass:"gitCommandSprite",callback:function(b){var c=b.items;b=a.getService("orion.page.message");var d=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doRebase(c.HeadLocation,c.Name,"BEGIN"),c.Name?g["Rebase on top of "]+c.Name:g.Rebase);b.createProgressMonitor(d,c.Name?g["Rebase on top of "]+c.Name:g.Rebase);d.then(function(b){var d=[],
p=c.HeadLocation.replace("commit/HEAD","status");"OK"===b.Result||"FAST_FORWARD"===b.Result||"UP_TO_DATE"===b.Result?(d.Severity="Ok",d.HTML=!1,d.Message=b.Result):"STOPPED"===b.Result?(d.Severity="Warning",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Some conflicts occurred. Please resolve them and continue, skip patch or abort rebasing"]+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(p)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e"):"FAILED_WRONG_REPOSITORY_STATE"===b.Result?
(d.Severity="Error",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Repository state is invalid (i.e. already during rebasing)"]+e.formatMessage(". Go to ${0}.",'\x3ca href\x3d"'+w(p)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e"):"FAILED_UNMERGED_PATHS"===b.Result?(d.Severity="Error",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Repository contains unmerged paths"]+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(p)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e"):
"FAILED_PENDING_CHANGES"===b.Result?(d.Severity="Error",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Repository contains pending changes. Please commit or stash them"]+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(p)+'"\x3eGit Status page\x3c/a\x3e')+".\x3c/span\x3e"):(d.Severity="Warning",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(p)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e");a.getService("orion.page.message").setProgressResult(d);
f.changedItem(c)},B)},visibleWhen:function(a){this.tooltip=g["Rebase your commits by removing them from the active branch, "]+g["starting the active branch again based on the latest state of '"]+a.Name+"' "+g["and applying each commit again to the updated active branch."];return"RemoteTrackingBranch"===a.Type||"Branch"===a.Type&&!a.Current}});d.addCommand(r);r=new h.Command({name:g["Push All"],tooltip:g["Push commits and tags from your local branch into the remote branch"],imageClass:"git-sprite-push",
spriteClass:"gitCommandSprite",id:"eclipse.orion.git.push",callback:function(c){var e=c.targetBranch,r,h=c.items;h.toRef&&(h=h.toRef);h.CloneLocation.split("/");var w=function(c,f){c.JsonData.HostKey?(f.parameters=null,f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword",
"password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],
{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=c.JsonData;f.errorData.failedOperation=c.failedOperation;d.collectParameters(f)})};if(c.parameters&&c.parameters.optionsRequested)c.parameters=null,c.optionsRequested=!0,d.collectParameters(c);else{var B=a.getService("orion.git.provider"),D=a.getService("orion.page.progress");c.errorData&&
c.errorData.failedOperation&&D.removeOperation(c.errorData.failedOperation);var l=function(b,d,e,r,h){var m=a.getService("orion.page.message");b=D.progress(B.doPush(d,e,!0,h,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+r);m.createProgressMonitor(b,g["Pushing remote: "]+r);b.then(function(b){p.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){w(a,c)})},function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem()},
function(a){w(a,c)})})};D.progress(B.getGitClone(h.CloneLocation),"Getting git repository details "+h.Name).then(function(b){var d=b.Children[0].RemoteLocation,f=b.Children[0].ConfigLocation,w=function(b){p.handleProgressServiceResponse(b,{},a)};p.gatherSshCredentials(a,c).then(function(b){var p=new k;if(1===h.RemoteLocation.length&&1===h.RemoteLocation[0].Children.length)p=D.progress(B.getGitRemote(d),"Getting git remote details "+h.Name);else{var m={};m.Children=h.RemoteLocation;p.resolve(m)}p.then(function(d){e?
l(b,e.Location,"HEAD",e.Name,!1):(d=new q.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:B,treeRoot:{Children:d.Children},hideNewBranch:!1,func:function(a,d,p){r=null===a?p:a;var e="branch."+h.Name+".remote";D.progress(B.addCloneConfigurationProperty(f,e,r.parent.Name),"Adding git configuration property "+h.Name).then(function(){c.targetBranch=r;l(b,r.Location,"HEAD",r.Name,!1)},function(a){409===a.status?B.getGitCloneConfig(f).then(function(a){if(a.Children)for(var d=
0;d<a.Children.length;d++)if(a.Children[d].Key===e){D.progress(B.editCloneConfigurationProperty(a.Children[d].Location,r.parent.Name),"Updating configuration property "+r.parent.Name).then(function(){c.targetBranch=r;l(b,r.Location,"HEAD",r.Name,!1)},w);break}},w):w(a)})}}),1===h.RemoteLocation.length&&1===h.RemoteLocation[0].Children.length&&(d=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:B,dialog:d,location:h.RemoteLocation[0].Children[0].Name,func:function(){c.targetBranch=
h.RemoteLocation[0].Children[0];l(b,h.RemoteLocation[0].Children[0].Location,"HEAD",h.Name,!1)}})),d.show())})})})}},visibleWhen:function(a){return a.toRef?""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation:"Branch"===a.Type&&a.Current&&a.RemoteLocation}});d.addCommand(r);r=new h.Command({name:g["Push Branch"],tooltip:g["Push commits without tags from your local branch into the remote branch"],imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushBranch",
callback:function(c){var e=c.targetBranch,r,h=c.items;h.toRef&&(h=h.toRef);h.CloneLocation.split("/");var w=function(c,f){c.JsonData.HostKey?(f.parameters=null,f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword",
"password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],
{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=c.JsonData;f.errorData.failedOperation=c.failedOperation;d.collectParameters(f)})};if(c.parameters&&c.parameters.optionsRequested)c.parameters=null,c.optionsRequested=!0,d.collectParameters(c);else{var B=a.getService("orion.git.provider"),D=a.getService("orion.page.progress");c.errorData&&
c.errorData.failedOperation&&D.removeOperation(c.errorData.failedOperation);var l=function(b,d,e,r,h){var m=a.getService("orion.page.message");b=D.progress(B.doPush(d,e,!1,h,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+r);m.createProgressMonitor(b,g["Pushing remote: "]+r);b.then(function(b){p.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){w(a,c)})},function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem()},
function(a){w(a,c)})})};D.progress(B.getGitClone(h.CloneLocation),"Getting git repository details "+h.Name).then(function(b){var d=b.Children[0].RemoteLocation,f=b.Children[0].ConfigLocation,w=function(b){p.handleProgressServiceResponse(b,{},a)};p.gatherSshCredentials(a,c).then(function(b){var p=new k;if(1===h.RemoteLocation.length&&1===h.RemoteLocation[0].Children.length)p=D.progress(B.getGitRemote(d),"Getting git remote details "+h.Name);else{var m={};m.Children=h.RemoteLocation;p.resolve(m)}p.then(function(d){e?
l(b,e.Location,"HEAD",e.Name,!1):(d=new q.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:B,treeRoot:{Children:d.Children},hideNewBranch:!1,func:function(a,d,p){r=null===a?p:a;var e="branch."+h.Name+".remote";D.progress(B.addCloneConfigurationProperty(f,e,r.parent.Name),"Adding git configuration property "+h.Name).then(function(){c.targetBranch=r;l(b,r.Location,"HEAD",r.Name,!1)},function(a){409===a.status?B.getGitCloneConfig(f).then(function(a){if(a.Children)for(var d=
0;d<a.Children.length;d++)if(a.Children[d].Key===e){D.progress(B.editCloneConfigurationProperty(a.Children[d].Location,r.parent.Name),"Updating configuration property "+r.parent.Name).then(function(){c.targetBranch=r;l(b,r.Location,"HEAD",r.Name,!1)},w);break}},w):w(a)})}}),1===h.RemoteLocation.length&&1===h.RemoteLocation[0].Children.length&&(d=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:B,dialog:d,location:h.RemoteLocation[0].Children[0].Name,func:function(){c.targetBranch=
h.RemoteLocation[0].Children[0];l(b,h.RemoteLocation[0].Children[0].Location,"HEAD",h.Name,!1)}})),d.show())})})})}},visibleWhen:function(a){return a.toRef?""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation:"Branch"===a.Type&&a.Current&&a.RemoteLocation}});d.addCommand(r);r=new h.Command({name:g["Push for Review"],tooltip:g["Push commits to Gerrit Code Review"],imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushToGerrit",callback:function(c){var e=
c.targetBranch,r=c.items;r.toRef&&(r=r.toRef);r.CloneLocation.split("/");var h=function(c,f){c.JsonData.HostKey?(f.parameters=null,f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,f.errorData.failedOperation=c.failedOperation,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),
new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):
new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=c.JsonData;f.errorData.failedOperation=c.failedOperation;d.collectParameters(f)})};if(c.parameters&&c.parameters.optionsRequested)c.parameters=null,c.optionsRequested=!0,d.collectParameters(c);else{var w=a.getService("orion.git.provider"),B=a.getService("orion.page.progress");c.errorData&&c.errorData.failedOperation&&
B.removeOperation(c.errorData.failedOperation);var q=function(b,d,e,r,m){var n=a.getService("orion.page.message");b=B.progress(w.doPush(d,e,!1,m,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+r);n.createProgressMonitor(b,g["Pushing remote: "]+r);b.then(function(b){p.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){h(a,c)})},function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){h(a,c)})})};B.progress(w.getGitClone(r.CloneLocation),
"Getting git repository details "+r.Name).then(function(b){var d=b.Children[0].RemoteLocation;p.gatherSshCredentials(a,c).then(function(b){var f=new k;if(1===r.RemoteLocation.length&&1===r.RemoteLocation[0].Children.length)f=B.progress(w.getGitRemote(d),"Getting git remote details "+r.Name);else{var p={};p.Children=r.RemoteLocation;f.resolve(p)}f.then(function(d){if(e)q(b,e.Location,"HEAD",e.Name,!1);else{c.targetBranch=r.RemoteLocation[0].Children[0];d=r.RemoteLocation[0].Children[0].Location.split("/");
d[4]=encodeURIComponent(encodeURIComponent("refs/for/master"));var f=d.join("/");c.targetBranch.Location=f;c.targetBranch.Name="refs/for/master";dialog=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:w,dialog:null,location:"refs/for/master",func:function(){q(b,f,"HEAD","refs/for/master",!1)}});dialog.show()}})})})}},visibleWhen:function(a){return a.toRef?""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation&&a.toRef.RemoteLocation[0].IsGerrit:
"Branch"===a.Type&&a.Current&&a.RemoteLocation&&a.RemoteLocation[0].IsGerrit}});d.addCommand(r);r=new h.Command({name:g["Force Push All"],tooltip:g["Push commits and tags from your local branch into the remote branch overriding its current content"],imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushForce",callback:function(c){var e=c.confirmedWarnings,r=c.targetBranch;if(!e)if(confirm(g["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+
"\n\n"+g["Are you sure?"]))e=c.confirmedWarnings=!0;else return;var h,w=c.items;w.toRef&&(w=w.toRef);var B=w.CloneLocation.split("/"),D=function(c,f){c.JsonData.HostKey?(f.parameters=null,f.errorData=c.JsonData,d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials",
"boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser",
"text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=c.JsonData;d.collectParameters(f)})};if(c.parameters&&c.parameters.optionsRequested)c.parameters=null,c.optionsRequested=!0,d.collectParameters(c);else{var l=a.getService("orion.git.provider"),s=a.getService("orion.page.progress"),I=function(b,d,e,r,h){var m=a.getService("orion.page.message");b=s.progress(l.doPush(d,e,!0,h,b.gitSshUsername,b.gitSshPassword,b.knownHosts,
b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+r);m.createProgressMonitor(b,g["Pushing remote: "]+r);b.then(function(b){p.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){D(a,c)})},function(b,d){p.handleGitServiceResponse(b,a,function(){f.changedItem(w)},function(a){D(a,c)})})};s.progress(l.getGitClone(w.CloneLocation),"Getting git repository details "+w.Name).then(function(b){var d=b.Children[0].RemoteLocation,f=b.Children[0].ConfigLocation;p.gatherSshCredentials(a,c).then(function(b){var p=
new k;if(1===w.RemoteLocation.length&&1===w.RemoteLocation[0].Children.length)p=s.progress(l.getGitRemote(d),"Getting remote details "+w.Name);else{var e={};e.Children=w.RemoteLocation;p.resolve(e)}p.then(function(d){r?I(b,r.Location,"HEAD",r.Name,!0):(d=new q.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:l,treeRoot:{Children:d.Children},hideNewBranch:!1,func:function(a,d,p){h=null===a?p:a;var e="/gitapi/config/branch."+w.Name+".remote/clone/file/"+B[4];s.progress(l.addCloneConfigurationProperty(f,
"branch."+w.Name+".remote",h.parent.Name),"Setting git configuration property "+w.Name).then(function(){c.targetBranch=h;I(b,h.Location,"HEAD",h.Name,!0)},function(a){409===a.status&&s.progres(l.editCloneConfigurationProperty(e,h.parent.Name),"Setting git configuration property "+h.parent.Name).then(function(){c.targetBranch=h;I(b,h.Location,"HEAD",h.Name,!0)})})}}),1===w.RemoteLocation.length&&1===w.RemoteLocation[0].Children.length&&(d=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,
gitClient:l,dialog:d,location:w.RemoteLocation[0].Children[0].Name,func:function(){c.targetBranch=w.RemoteLocation[0].Children[0];I(b,w.RemoteLocation[0].Children[0].Location,"HEAD",w.Location,!0)}})),d.show())})})})}},visibleWhen:function(a){if(a.toRef)return""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation}});d.addCommand(r);r=new h.Command({name:g["Force Push Branch"],tooltip:g["Push commits without tags from your local branch into the remote branch overriding its current content"],
imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushForceBranch",callback:function(c){var e=c.confirmedWarnings,r=c.targetBranch;if(!e)if(confirm(g["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+"\n\n"+g["Are you sure?"]))e=c.confirmedWarnings=!0;else return;var h,w=c.items;w.toRef&&(w=w.toRef);var B=w.CloneLocation.split("/"),D=function(c,f){c.JsonData.HostKey?(f.parameters=null,f.errorData=c.JsonData,
d.collectParameters(f)):f.optionsRequested?(f.errorData=c.JsonData,d.collectParameters(f)):(new m(a)).isEnabled().then(function(a){f.parameters=a?c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),
new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):c.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=c.JsonData;d.collectParameters(f)})};if(c.parameters&&c.parameters.optionsRequested)c.parameters=
null,c.optionsRequested=!0,d.collectParameters(c);else{var l=a.getService("orion.git.provider"),s=a.getService("orion.page.progress"),I=function(b,d,e,r,h){var m=a.getService("orion.page.message");b=s.progress(l.doPush(d,e,!1,h,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+r);m.createProgressMonitor(b,g["Pushing remote: "]+r);b.then(function(b){p.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){D(a,c)})},function(b,d){p.handleGitServiceResponse(b,
a,function(){f.changedItem(w)},function(a){D(a,c)})})};s.progress(l.getGitClone(w.CloneLocation),"Getting git repository details "+w.Name).then(function(b){var d=b.Children[0].RemoteLocation,f=b.Children[0].ConfigLocation;p.gatherSshCredentials(a,c).then(function(b){var p=new k;if(1===w.RemoteLocation.length&&1===w.RemoteLocation[0].Children.length)p=s.progress(l.getGitRemote(d),"Getting remote details "+w.Name);else{var e={};e.Children=w.RemoteLocation;p.resolve(e)}p.then(function(d){r?I(b,r.Location,
"HEAD",r.Name,!0):(d=new q.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:l,treeRoot:{Children:d.Children},hideNewBranch:!1,func:function(a,d,p){h=null===a?p:a;var e="/gitapi/config/branch."+w.Name+".remote/clone/file/"+B[4];s.progress(l.addCloneConfigurationProperty(f,"branch."+w.Name+".remote",h.parent.Name),"Setting git configuration property "+w.Name).then(function(){c.targetBranch=h;I(b,h.Location,"HEAD",h.Name,!0)},function(a){409===a.status&&s.progres(l.editCloneConfigurationProperty(e,
h.parent.Name),"Setting git configuration property "+h.parent.Name).then(function(){c.targetBranch=h;I(b,h.Location,"HEAD",h.Name,!0)})})}}),1===w.RemoteLocation.length&&1===w.RemoteLocation[0].Children.length&&(d=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:l,dialog:d,location:w.RemoteLocation[0].Children[0].Name,func:function(){c.targetBranch=w.RemoteLocation[0].Children[0];I(b,w.RemoteLocation[0].Children[0].Location,"HEAD",w.Location,!0)}})),d.show())})})})}},
visibleWhen:function(a){if(a.toRef)return""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation}});d.addCommand(r);r=new h.Command({name:g["\x3c Previous Page"],tooltip:g["Show previous page of git log"],id:"eclipse.orion.git.previousLogPage",hrefCallback:function(a){return l.toUrl(F.expand({resource:a.items.PreviousLocation}))},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||a.toRef&&"Branch"===a.toRef.Type||null!==a.RepositoryPath?void 0!==a.PreviousLocation:
!1}});d.addCommand(r);r=new h.Command({name:g["Next Page \x3e"],tooltip:g["Show next page of git log"],id:"eclipse.orion.git.nextLogPage",hrefCallback:function(a){return l.toUrl(F.expand({resource:a.items.NextLocation}))},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||a.toRef&&"Branch"===a.toRef.Type||null!==a.RepositoryPath?void 0!==a.NextLocation:!1}});d.addCommand(r);r=new h.Command({name:g["\x3c Previous Page"],tooltip:g["Show previous page of git tags"],id:"eclipse.orion.git.previousTagPage",
hrefCallback:function(a){return l.toUrl(D.expand({resource:a.items.PreviousLocation}))},visibleWhen:function(a){return"Tag"===a.Type?void 0!==a.PreviousLocation:!1}});d.addCommand(r);r=new h.Command({name:g["Next Page \x3e"],tooltip:g["Show next page of git tags"],id:"eclipse.orion.git.nextTagPage",hrefCallback:function(a){return l.toUrl(D.expand({resource:a.items.NextLocation}))},visibleWhen:function(a){return"Tag"===a.Type?void 0!==a.NextLocation:!1}});d.addCommand(r);r=new h.Command({name:g.Reset,
tooltip:g["Reset your active branch to the state of the selected branch. Discard all staged and unstaged changes."],id:"eclipse.orion.git.resetIndex",imageClass:"git-sprite-reset",spriteClass:"gitCommandSprite",callback:function(b){var c=b.items;if(confirm(e.formatMessage(g.GitResetIndexConfirm,c.Name))){b=a.getService("orion.git.provider");var d=a.getService("orion.page.message");b=a.getService("orion.page.progress").progress(b.resetIndex(c.IndexLocation,c.Name),"Resetting git index for "+c.Name);
d.createProgressMonitor(b,g["Resetting index..."]);b.then(function(a){f.changedItem(c);d.setProgressResult({Severity:"Info",HTML:!1,Message:"Ok"})},function(a){var b={Severity:"Error",HTML:!1};b.Message=a.message;d.setProgressResult(b)})}},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("name","text",g["Name:"])]);r=new h.Command({name:g.Tag,tooltip:g["Create a tag for the commit"],imageClass:"git-sprite-tag",spriteClass:"gitCommandSprite",
id:"eclipse.orion.git.addTag",parameters:r,callback:function(b){var c=b.items,d=function(b,d){a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doAddTag(b,d),"Adding tag "+d).then(function(){f.changedItem(c)},B)},p=c.Location;b.parameters.valueFor("name")&&!b.parameters.optionsRequested&&d(p,b.parameters.valueFor("name"))},visibleWhen:function(a){return"Commit"===a.Type}});d.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the tag from the repository"],
imageClass:"core-sprite-delete",id:"eclipse.removeTag",callback:function(b){var c=b.items;confirm(e.formatMessage(g["Are you sure you want to delete tag ${0}?"],c.Name))&&a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doRemoveTag(c.Location),"Removing tag "+c.Name).then(function(){f.changedItem(c.parent)},B)},visibleWhen:function(a){return"Tag"===a.Type}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("reviewer","text",g["Reviewer name"])],
{hasOptionalParameters:!0});r=new h.Command({name:g["Ask for review"],tooltip:g["Ask for review tooltip"],imageClass:"core-sprite-tag",id:"eclipse.orion.git.askForReviewCommand",parameters:r,callback:function(b){var c=a.getService("orion.page.progress"),d=function(a){var b=document.createElement("a");b.href=a;"ssh:"===b.protocol&&(b=a.indexOf("@"),-1!==b&&(a="ssh://"+a.substr(b+1)));return a},f=function(f){var p=b.items,e=p.Location.replace(p.Name,"HEAD"),r=p.AuthorName,h=p.Name,w=p.Message;c.progress(a.getService("orion.git.provider").getGitClone(p.CloneLocation),
"Getting repository details "+p.Name).then(function(b){window.location.href.split("#");var g=A.getOrionHome();b=d(b.Children[0].GitUrl);g=g+"/git/reviewRequest.html#"+b+"_"+p.Name;c.progress(a.getService("orion.git.provider").sendCommitReviewRequest(h,e,f,g,r,w),"Sending review request for "+h).then(function(b){var c={Severity:"Ok",HTML:!1};c.Message=b.Result;a.getService("orion.page.message").setProgressResult(c)},B)})};if(b.parameters.valueFor("reviewer")&&!b.parameters.optionsRequested)f(b.parameters.valueFor("reviewer"));
else{var p=b.items;c.progress(a.getService("orion.git.provider").getGitClone(p.CloneLocation),"Getting git details "+p.Name).then(function(a){window.location.href.split("#");var b=A.getOrionHome();a=d(a.Children[0].GitUrl);(new s.ReviewRequestDialog({title:g["Contribution Review Request"],url:b+"/git/reviewRequest.html#"+a+"_"+p.Name,func:f})).show()},B)}},visibleWhen:function(a){return"Commit"===a.Type}});d.addCommand(r);r=new h.Command({name:g["Cherry-Pick"],tooltip:g["Apply the change introduced by the commit to your active branch"],
id:"eclipse.orion.git.cherryPick",imageClass:"git-sprite-cherry-pick",spriteClass:"gitCommandSprite",callback:function(b){var c=b.items;b=a.getService("orion.page.progress");var d=a.getService("orion.git.provider"),f=c.Location.replace(c.Name,"HEAD");b.progress(d.doCherryPick(f,c.Name),"Cherry picking "+c.Name).then(function(b){var d=[],f=c.Location.replace("commit/"+c.Name,"status");if("OK"===b.Result)d.Severity="Ok",b.HeadUpdated?(d.HTML=!1,d.Message=b.Result):(d.HTML=!0,d.Message="\x3cspan\x3e"+
g["Nothing changed."]+"\x3c/span\x3e");else if("CONFLICTING"===b.Result)d.Severity="Warning",d.HTML=!0,f=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(f)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e",d.Message="\x3cspan\x3e"+b.Result+g[". Some conflicts occurred"]+f;else if("FAILED"===b.Result){d.Severity="Error";d.HTML=!0;d.Message="\x3cspan\x3e"+b.Result;if(b.FailingPaths){var p="",r=!0,h;for(h in b.FailingPaths)r||(p+=", "),r=!1,p+=h;r||(d.Message+=". "+e.formatMessage(g["Failing paths: ${0}"],
p))}d.Message+=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(f)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e"}else d.Severity="Warning",d.HTML=!1,d.Message=b.Result;a.getService("orion.page.message").setProgressResult(d)},B)},visibleWhen:function(a){return"Commit"===a.Type}});d.addCommand(r);r=new h.Command({name:g.Revert,tooltip:g["Revert changes introduced by the commit into your active branch"],id:"eclipse.orion.git.revert",imageClass:"git-sprite-reset",spriteClass:"gitCommandSprite",
callback:function(b){var c=b.items;b=a.getService("orion.page.progress");var d=a.getService("orion.git.provider"),f=c.Location.replace(c.Name,"HEAD");b.progress(d.doRevert(f,c.Name),"Reverting "+c.Name).then(function(b){var d=[],f=c.Location.replace("commit/"+c.Name,"status");"OK"===b.Result?(d.Severity="Ok",d.HTML=!1,d.Message=b.Result):"FAILURE"===b.Result?(f=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+w(f)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e",d.Severity="Warning",
d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Could not revert into active branch"]+f):(d.Severity="Warning",d.HTML=!1,d.Message=b.Result);a.getService("orion.page.message").setProgressResult(d)},B)},visibleWhen:function(a){return"Commit"===a.Type}});d.addCommand(r)};p.createGitClonesCommands=function(c,d,f,r,w,n){function B(a){var b={Severity:"Error",HTML:!1};try{var d=JSON.parse(a.responseText);b.Message=d.DetailedMessage?d.DetailedMessage:d.Message?d.Message:g["Problem while performing the action"]}catch(f){b.Message=
g["Problem while performing the action"]}c.getService("orion.page.message").setProgressResult(b)}function q(a){Array.isArray(a)&&(a=1<a.length?{}:a[0]);return a}r=new b.ParametersDescription([new b.CommandParameter("key","text",g["Key:"]),new b.CommandParameter("value","text",g["Value:"])]);r=new h.Command({name:g["New Configuration Entry"],tooltip:"Add a new entry to the repository configuration",id:"eclipse.orion.git.addConfigEntryCommand",parameters:r,callback:function(a){var b=a.items,d=c.getService("orion.git.provider"),
p=c.getService("orion.page.progress");a.parameters.valueFor("key")&&a.parameters.valueFor("value")&&p.progress(d.addCloneConfigurationProperty(b.ConfigLocation,a.parameters.valueFor("key"),a.parameters.valueFor("value")),"Setting configuration propetry: "+a.parameters.valueFor("key")).then(function(a){f.changedItem(b)},B)}});d.addCommand(r);r=new b.ParametersDescription([],null,function(a){a=a.items;var c;a&&(c=a.Value);return[new b.CommandParameter("value","text",g["Value:"],c)]});r=new h.Command({name:g.Edit,
tooltip:g["Edit the configuration entry"],imageClass:"core-sprite-edit",id:"eclipse.orion.git.editConfigEntryCommand",parameters:r,callback:function(a){var b=a.items,d=c.getService("orion.git.provider"),p=c.getService("orion.page.progress");a.parameters.valueFor("value")&&p.progress(d.editCloneConfigurationProperty(b.Location,a.parameters.valueFor("value")),"Editing configuration property "+b.Key).then(function(a){f.changedItem(b)},B)},visibleWhen:function(a){return a.Key&&a.Value&&a.Location}});
d.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the configuration entry"],imageClass:"core-sprite-delete",id:"eclipse.orion.git.deleteConfigEntryCommand",callback:function(a){var b=a.items;a=c.getService("orion.git.provider");var d=c.getService("orion.page.progress");confirm(e.formatMessage(g["Are you sure you want to delete ${0}?"],b.Key))&&d.progress(a.deleteCloneConfigurationProperty(b.Location),"Deleting configuration property "+b.Key).then(function(a){f.changedItem(b)},B)},visibleWhen:function(a){return a.Key&&
a.Value&&a.Location}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("url","url",g["Repository URL:"])],{hasOptionalParameters:!0});w=new h.Command({name:g["Clone Repository"],tooltip:g["Clone an existing Git repository to a folder"],id:"eclipse.createGitProject",callback:function(b){var d=b.items,e=c.getService("orion.git.provider"),r=c.getService("orion.page.progress"),h=function(b,h,w){d.GitUrl=b;p.getDefaultSshOptions(c,d).then(function(m){var B=arguments.callee,q=new a(c);
c.getService("orion.page.message").setProgressMessage("Your project is being set up. This may take a minute...");q.getConfig().then(function(a){r.progress(e.cloneGitRepository(w,b,h,f.defaultPath,m.gitSshUsername,m.gitSshPassword,m.knownHosts,m.gitPrivateKey,m.gitPassphrase,a,!0),"Cloning repository "+w).then(function(a,b){p.handleProgressServiceResponse(a,m,c,function(a){e.getGitClone(a.Location).then(function(a){var b="",c;for(c in d.projectDescription)b+=c+"\x3d"+d.projectDescription[c]+"\n";n.write(a.Children[0].ContentLocation+
".git/.projectInfo",b).then(function(){var b=l.toUrl(G.expand({resource:a.Children[0].ContentLocation}));window.location=b})})},B,g["Clone Git Repository"])},function(a,b){p.handleProgressServiceResponse(a,m,c,function(){},B,g["Clone Git Repository"])})})})};d.url&&d.projectDescription.name&&(c.getService("orion.page.message").setProgressMessage("Looking for project "+d.projectDescription.name),n.loadWorkspace().then(function(a){for(var b=0;b<a.Children.length;++b){var c=a.Children[b];if(c.Name===
d.projectDescription.name){c.Git?e.getGitClone(c.Git.CloneLocation).then(function(a){a.Children[0].GitUrl===d.url?window.location=l.toUrl(G.expand({resource:a.Children[0].ContentLocation})):console.info("Folder project is used")}):console.info("Folder project is used");return}}h(d.url,null,d.projectDescription.name)}))},visibleWhen:function(a){return!0}});d.addCommand(w);r=new h.Command({name:g["Clone Repository"],tooltip:g["Clone an existing Git repository to a folder"],id:"eclipse.cloneGitRepository",
parameters:r,callback:function(b){var d=b.items,e=c.getService("orion.git.provider"),r=c.getService("orion.page.progress"),h=function(b,h,w){d.GitUrl=b;p.getDefaultSshOptions(c,d).then(function(d){var m=arguments.callee;(new a(c)).getConfig().then(function(a){a=r.progress(e.cloneGitRepository(w,b,h,f.defaultPath,d.gitSshUsername,d.gitSshPassword,d.knownHosts,d.gitPrivateKey,d.gitPassphrase,a),"Cloning repository "+w);c.getService("orion.page.message").createProgressMonitor(a,g["Cloning repository: "]+
b);a.then(function(a,b){p.handleProgressServiceResponse(a,d,c,function(a){f.changedItem&&f.changedItem()},m,g["Clone Git Repository"])},function(a,b){p.handleProgressServiceResponse(a,d,c,function(){},m,g["Clone Git Repository"])})})})};b.parameters.valueFor("url")&&!b.parameters.optionsRequested?h(b.parameters.valueFor("url")):(new t.CloneGitRepositoryDialog({serviceRegistry:c,fileClient:n,url:b.parameters.valueFor("url"),alwaysShowAdvanced:b.parameters.optionsRequested,func:h})).show()},visibleWhen:function(a){return!0}});
d.addCommand(r);r=new h.Command({name:g["Clone Repository"],tooltip:g["Clone an existing Git repository to a folder"],id:"eclipse.cloneGitRepositoryReviewReq",callback:function(b){var d=b.items,e=c.getService("orion.git.provider"),r=c.getService("orion.page.progress");(new t.CloneGitRepositoryDialog({serviceRegistry:c,fileClient:n,url:b.userData,alwaysShowAdvanced:!1,func:function(b,h,w){d.GitUrl=b;p.getDefaultSshOptions(c,d).then(function(d){var m=arguments.callee;(new a(c)).getConfig().then(function(a){a=
r.progress(e.cloneGitRepository(w,b,h,f.defaultPath,d.gitSshUsername,d.gitSshPassword,d.knownHosts,d.gitPrivateKey,d.gitPassphrase,a),"Cloning git repository "+w);c.getService("orion.page.message").createProgressMonitor(a,g["Cloning repository: "]+b);a.then(function(a,b){p.handleProgressServiceResponse(a,d,c,function(a){f.changedItem&&f.changedItem()},m,g["Clone Git Repository"])},function(a,b){p.handleProgressServiceResponse(a,d,c,function(){},m,g["Clone Git Repository"])})})})}})).show()},visibleWhen:function(a){return!0}});
d.addCommand(r);r=new h.Command({name:g["Add Remote"],tooltip:g["Add a new remote to the repository"],id:"eclipse.addRemoteReviewRequestCommand",imageClass:"git-sprite-fetch",spriteClass:"gitCommandSprite",callback:function(a){a.parameters&&a.parameters.valueFor("remoteName")&&(a.remoteName=a.parameters.valueFor("remoteName"));var e=function(a,f){a.JsonData.HostKey?(f.parameters=null,f.errorData=a.JsonData,d.collectParameters(f)):f.optionsRequested?(f.errorData=a.JsonData,d.collectParameters(f)):
(new m(c)).isEnabled().then(function(c){f.parameters=c?a.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],
{hasOptionalParameters:!0}):a.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});f.errorData=a.JsonData;d.collectParameters(f)})};if(a.parameters&&a.parameters.optionsRequested)a.parameters=null,a.optionsRequested=!0,d.collectParameters(a);
else{var r=function(b,d,r){var h=c.getService("orion.page.progress");h.progress(c.getService("orion.git.provider").addRemote(b,d,a.userData),"Adding git remote "+d).then(function(){p.gatherSshCredentials(c,a).then(function(b){c.getService("orion.git.provider").getGitRemote(r.RemoteLocation).then(function(w){for(var m,n=0;n<w.Children.length;n++)w.Children[n].Name===d&&(m=w.Children[n]);var q=c.getService("orion.git.provider");w=c.getService("orion.page.message");n=h.progress(q.doFetch(m.Location,
!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),"Fetching remote "+d);w.createProgressMonitor(n,g["Fetching remote: "]+m.Location);n.then(function(b,w){p.handleGitServiceResponse(b,c,function(){h.progress(q.getGitRemote(m.Location),"Getting remote details "+d).then(function(a){f.changedItem(r)},B)},function(b){e(b,a)})},function(b,d){p.handleGitServiceResponse(b,c,function(){f.changedItem(r)},function(b){e(b,a)})})})})},B)};a.remoteName?r(a.items.RemoteLocation,
a.remoteName,a.items):(a.parameters=new b.ParametersDescription([new b.CommandParameter("remoteName","text",g["Remote Name:"])],{hasOptionalParameters:!1}),d.collectParameters(a))}},visibleWhen:function(a){return!0}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("folderName","text",g["New folder:"])],{hasOptionalParameters:!0});r=new h.Command({name:g["Init Repository"],tooltip:g["Create a new Git repository in a new folder"],id:"eclipse.initGitRepository",parameters:r,callback:function(b){var d=
b.items,e=c.getService("orion.git.provider"),r=c.getService("orion.page.progress"),h=function(b,h,w){d.GitUrl=b;p.getDefaultSshOptions(c,d).then(function(d){var m=arguments.callee;(new a(c)).getConfig().then(function(a){a=r.progress(e.cloneGitRepository(w,b,h,f.defaultPath,null,null,null,null,null,a),g["Initializing repository: "]+w);c.getService("orion.page.message").createProgressMonitor(a,g["Initializing repository: "]+w);a.then(function(a,b){p.handleProgressServiceResponse(a,d,c,function(a){f.changedItem&&
f.changedItem()},m,g["Init Git Repository"])},function(a,b){p.handleProgressServiceResponse(a,d,c,function(){},m,g["Init Git Repository"])})})})};b.parameters.valueFor("folderName")&&!b.parameters.optionsRequested?h(null,null,b.parameters.valueFor("folderName")):(new t.CloneGitRepositoryDialog({serviceRegistry:c,title:g["Init Git Repository"],fileClient:n,advancedOnly:!0,func:h})).show()},visibleWhen:function(a){return!0}});d.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the repository"],
imageClass:"core-sprite-delete",id:"eclipse.git.deleteClone",visibleWhen:function(a){return"Clone"===a.Type},callback:function(a){var b=a.items;a=c.getService("orion.git.provider");var d=c.getService("orion.page.progress");if(Array.isArray(b)){if(confirm(e.formatMessage(g["Are you sure you want do delete ${0} repositories?"],b.length)))for(var p=0,r=0;r<b.length;r++)d.progress(a.removeGitRepository(b[r].Location),"Removing repository "+b.Name).then(function(a){p++;p>=b.length&&f.changedItem&&f.changedItem()},
B)}else confirm(e.formatMessage(g["Are you sure you want to delete ${0}?"],b.Name))&&d.progress(a.removeGitRepository(b.Location),"Removing repository "+b.Name).then(function(a){f.changedItem&&(window.location=l.toUrl(D.expand({})),f.changedItem())},B)}});d.addCommand(r);r=new h.Command({name:g["Apply Patch"],tooltip:g["Apply a patch on the selected repository"],id:"eclipse.orion.git.applyPatch",imageClass:"git-sprite-apply-patch",spriteClass:"gitCommandSprite",callback:function(a){a=q(a.items);var b=
new k;(new x.ApplyPatchDialog({title:g["Apply Patch"],diffLocation:a.DiffLocation,deferred:b})).show();var d=c.getService("orion.page.message");b.then(function(a){var b;try{var c=JSON.parse(a);if(c.JsonData&&c.JsonData.modifiedFieles){b="Patch applied, files modified: ";a=!0;for(var f=0;f<c.JsonData.modifiedFieles.length;f++)a||(b+=", "),b+=c.JsonData.modifiedFieles[f],a=!1;c=[];c.Severity="Info";c.HTML=!1;c.Message=b;d.setProgressResult(c);return}}catch(p){}d.setMessage("Patch applied")},function(a){var b=
JSON.parse(a);a="Apply patch failed.";b.DetailedMessage?a=a+" "+b.DetailedMessage:b.Message&&(a+=" ",a+=b.Message);b=[];b.Severity="Error";b.HTML=!1;b.Message=a;d.setProgressResult(b)})},visibleWhen:function(a){return"Clone"===a.Type}});d.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("commitName","text",g["Commit name:"])],{hasOptionalParameters:!0});r=new h.Command({name:g["Open Commit"],tooltip:g["Open the commit with the given name"],id:"eclipse.orion.git.openCommitCommand",
imageClass:"git-sprite-apply-patch",spriteClass:"gitCommandSprite",parameters:r,callback:function(a){var b=c.getService("orion.page.progress"),d=function(f,p,e){null==e&&(e=new k);0<f.length?b.progress(c.getService("orion.git.provider").doGitLog("/gitapi/commit/"+a.parameters.valueFor("commitName")+f[0].ContentLocation+"?page\x3d1\x26pageSize\x3d1",null,null,g["Looking for the commit"]),"Looking for commit "+a.parameters.valueFor("commitName")).then(function(a){e.resolve(a.Children[0].Location)},
function(a){d(f.slice(1),p,e)}):e.reject();return e},f=function(b){a.parameters.optionsRequested?(new u.OpenCommitDialog({repositories:b,serviceRegistry:c,commitName:a.parameters.valueFor("commitName")})).show():(c.getService("orion.page.message").setProgressMessage(g["Looking for the commit"]),d(b,a.parameters.valueFor("commitName")).then(function(a){a&&(a=l.toUrl(J.expand({resource:a})),window.open(a));c.getService("orion.page.message").setProgressMessage("")},function(){var a=[];a.Severity="warning";
a.HTML=!1;a.Message=g["No commits found"];c.getService("orion.page.message").setProgressResult(a)}))};if("Clone"===a.items.Type){var p=[a.items];f(p)}else a.items.CloneLocation?b.progress(c.getService("orion.git.provider").getGitClone(a.items.CloneLocation),"Getting git repository details").then(function(a){f(a.Children)}):(p=a.items,f(p))},visibleWhen:function(a){return"Clone"===a.Type||a.CloneLocation||1<a.length&&"Clone"===a[0].Type}});d.addCommand(r)};p.createGitStatusCommands=function(a,c,d){function p(b){var c=
{Severity:"Error",HTML:!1};try{var d=JSON.parse(b.responseText);c.Message=d.DetailedMessage?d.DetailedMessage:d.Message?d.Message:g["Problem while performing the action"]}catch(f){c.Message=g["Problem while performing the action"]}a.getService("orion.page.message").setProgressResult(c)}function e(a){Array.isArray(a)||(a=[a]);return a}function r(b,c){var f=a.getService("orion.page.message"),e=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doRebase(b,"",c),"Rebasing git repository");
f.createProgressMonitor(e,c);e.then(function(b){if("OK"===b.Result||"ABORTED"===b.Result||"FAST_FORWARD"===b.Result||"UP_TO_DATE"===b.Result){var c=[];c.Severity="Ok";c.HTML=!1;c.Message=b.Result;a.getService("orion.page.message").setProgressResult(c);d.changedItem({})}"STOPPED"===b.Result?(c=[],c.Severity="Warning",c.HTML=!1,c.Message=b.Result+g[". Repository still contains conflicts."],a.getService("orion.page.message").setProgressResult(c),d.changedItem({})):"FAILED_UNMERGED_PATHS"===b.Result&&
(c=[],c.Severity="Error",c.HTML=!1,c.Message=b.Result+g[". Repository contains unmerged paths. Resolve conflicts first."],a.getService("orion.page.message").setProgressResult(c))},p)}var w=new h.Command({name:g.Stage,tooltip:g["Stage the change"],imageClass:"git-sprite-stage",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.stageCommand",callback:function(b){var c=e(b.items),f=a.getService("orion.page.message"),r=a.getService("orion.page.progress");if(1===c.length)b=r.progress(a.getService("orion.git.provider").stage(c[0].indexURI),
g["Staging changes"]),f.createProgressMonitor(b,g["Staging changes"]),b.then(function(a){d.changedItem(c)},p);else{for(var h=[],w=0;w<c.length;w++)h[w]=c[w].name;b=r.progress(a.getService("orion.git.provider").stageMultipleFiles(b.userData.Clone.IndexLocation,h),g["Staging changes"]);f.createProgressMonitor(b,"Staging changes");b.then(function(a){d.changedItem(c)},p)}},visibleWhen:function(a){a=e(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(!f.isChange(a[b])||f.isStaged(a[b]))return!1;
return!0}});c.addCommand(w);w=new h.Command({name:g.Unstage,tooltip:g["Unstage the change"],imageClass:"git-sprite-unstage",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.unstageCommand",callback:function(b){var c=e(b.items),f=a.getService("orion.page.message"),r=a.getService("orion.page.progress");if(1===c.length)b=r.progress(a.getService("orion.git.provider").unstage(c[0].indexURI,c[0].name),"Unstaging changes"),f.createProgressMonitor(b,g["Staging changes"]),b.then(function(a){d.changedItem(c)},
p);else{for(var h=[],w=0;w<c.length;w++)h[w]=c[w].name;b=r.progress(a.getService("orion.git.provider").unstage(b.userData.Clone.IndexLocation,h),"Unstaging changes");f.createProgressMonitor(b,g["Staging changes"]);b.then(function(a){d.changedItem(c)},p)}},visibleWhen:function(a){a=e(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(!f.isChange(a[b])||!f.isStaged(a[b]))return!1;return!0}});c.addCommand(w);w=new b.CommandEventListener("change",function(b,c){var d=b.target,f=c.items.status,p=
document.getElementById("nameparameterCollector");d.checked?(d=a.getService("orion.page.message"),f=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doGitLog(f.CommitLocation+"?page\x3d1\x26pageSize\x3d1"),g["Fetching previous commit message"]),d.createProgressMonitor(f,g["Fetching previous commit message"],f.then(function(a){p.value=a.Children[0].Message}),function(a){p.value=""})):p.value=""});w=new b.ParametersDescription([new b.CommandParameter("name","text",g["Commit message:"],
"",4),new b.CommandParameter("amend","boolean",g["Amend:"],!1,null,w),new b.CommandParameter("changeId","boolean",g["ChangeId:"],!1)],{hasOptionalParameters:!0});w=new h.Command({name:g.Commit,tooltip:g.Commit,id:"eclipse.orion.git.commitCommand",parameters:w,callback:function(b){var c=b.items.status,f=function(b){var f=a.getService("orion.page.message");b=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").commitAll(c.Clone.HeadLocation,null,JSON.stringify(b)),g["Committing changes"]);
f.createProgressMonitor(b,g["Committing changes"]);b.then(function(a){d.changedItem(c)},p)},e=function(a,c){for(var d=0;d<c.length;d++)"user.name"===c[d].Key?(a.CommitterName=c[d].Value,a.AuthorName=c[d].Value):"user.email"===c[d].Key&&(a.CommitterEmail=c[d].Value,a.AuthorEmail=c[d].Value);a.Message&&a.CommitterName&&a.CommitterEmail&&!b.parameters.optionsRequested?f(a):(new v.CommitDialog({body:a,func:f})).show()},r={};r.Message=b.parameters.valueFor("name");r.Amend=b.parameters.valueFor("amend");
r.ChangeId=b.parameters.valueFor("changeId");var h=c.Clone.Config;if(r.Amend&&!r.Message){var w=a.getService("orion.page.message"),m=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doGitLog(c.CommitLocation+"?page\x3d1\x26pageSize\x3d1"),g["Committing changes"]);w.createProgressMonitor(m,g["Committing changes"]);m.then(function(a){r.Message=a.Children[0].Message;e(r,h)},function(a){e(r,h)})}else e(r,h)},visibleWhen:function(a){return!0}});c.addCommand(w);w=new h.Command({name:g.Reset,
tooltip:g["Reset the branch, discarding all staged and unstaged changes"],imageClass:"core-sprite-refresh",id:"eclipse.orion.git.resetCommand",callback:function(b){var c=b.items;a.getService("orion.page.dialog").confirm(g["All unstaged and staged changes in the working directory and index will be discarded and cannot be recovered."]+"\n"+g["Are you sure you want to continue?"],function(b){if(b){b=a.getService("orion.page.message");var f=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").unstageAll(c.IndexLocation,
"HARD"),g["Resetting local changes"]);b.createProgressMonitor(f,g["Resetting local changes"]);f.then(function(a){d.changedItem(c)},p)}})},visibleWhen:function(a){return f.hasStagedChanges(a)||f.hasUnstagedChanges(a)}});c.addCommand(w);w=new h.Command({name:g.Checkout,tooltip:g["Checkout all the selected files, discarding all changes"],imageClass:"git-sprite-checkout",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.checkoutCommand",callback:function(b){var c=e(b.items);a.getService("orion.page.dialog").confirm(g["Your changes to the selected files will be discarded and cannot be recovered."]+
"\n"+g["Are you sure you want to continue?"],function(f){if(f){f=a.getService("orion.page.message");for(var e=a.getService("orion.page.progress"),r=[],h=0;h<c.length;h++)r[h]=c[h].name;e=e.progress(a.getService("orion.git.provider").checkoutPath(b.userData.Clone.Location,r),g["Resetting local changes"]);f.createProgressMonitor(e,g["Resetting local changes"]);e.then(function(a){d.changedItem(c)},p)}})},visibleWhen:function(a){a=e(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(!f.isChange(a[b])||
f.isStaged(a[b]))return!1;return!0}});c.addCommand(w);w=new h.Command({name:g["Show Patch"],tooltip:g["Show workspace changes as a patch"],id:"eclipse.orion.git.showPatchCommand",hrefCallback:function(a){var b=e(a.items);a=a.userData.Clone.DiffLocation+"?parts\x3ddiff";for(var c=0;c<b.length;c++)a+="\x26Path\x3d",a+=b[c].name;return a},visibleWhen:function(a){a=e(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(f.isStaged(a[b]))return!1;return!0}});c.addCommand(w);w=new h.Command({name:g.Continue,
tooltip:g["Contibue Rebase"],id:"eclipse.orion.git.rebaseContinueCommand",callback:function(a){return r(a.items.Clone.HeadLocation,"CONTINUE")},visibleWhen:function(a){return-1!==a.RepositoryState.indexOf("REBASING")}});c.addCommand(w);w=new h.Command({name:g["Skip Patch"],tooltip:g["Skip Patch"],id:"eclipse.orion.git.rebaseSkipPatchCommand",callback:function(a){return r(a.items.Clone.HeadLocation,"SKIP")},visibleWhen:function(a){return-1!==a.RepositoryState.indexOf("REBASING")}});c.addCommand(w);
w=new h.Command({name:g.Abort,tooltip:g["Abort Rebase"],id:"eclipse.orion.git.rebaseAbortCommand",callback:function(a){return r(a.items.Clone.HeadLocation,"ABORT")},visibleWhen:function(a){return-1!==a.RepositoryState.indexOf("REBASING")}});c.addCommand(w)}})();return p});
define("orion/compare/nls/root/messages",{"Copy current change from right to left":"Copy current change from right to left","Copy current change from left to right":"Copy current change from left to right","Switch to unified diff":"Switch to unified diff",Unified:"Unified","Switch to side by side diff":"Switch to side by side diff","Side by side":"Side by side","Generate link of the current diff":"Generate link of the current diff","Generate Link":"Generate Link","Next diff block":"Next diff block",
"Previous diff block":"Previous diff block","Next diff change":"Next diff change","Previous diff change":"Previous diff change","Copy the link URL:":"Copy the link URL:",Compare:"Compare","Open the compare page":"Open the compare page","fetching...":"fetching...","There are unsaved changes.":"There are unsaved changes.","ERROR: ":"ERROR: ","Compare...":"Compare...","files changed":" files changed",Location:"Location",Options:"Options","Sort by folders":"Sort by folders","Line 0 : Col 0":"Line 0 : Col 0",
"No Matching DiffService for location:":"No Matching DiffService for location:","${0} files compared. The two folders are identical.":"${0} files compared. The two folders are identical."});define("orion/compare/nls/messages",["orion/i18n!orion/compare/nls/messages","orion/compare/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/compare/compareCommands",["i18n!orion/compare/nls/messages","orion/commands","orion/keyBinding","orion/webui/littlelib"],function(g,l,k,e){var d={};d.CompareCommandFactory=function(){function d(b){this.setOptions(b,!0)}d.prototype={setOptions:function(b,d){d&&(this.options={});this.options||(this.options={});b&&Object.keys(b).forEach(function(c){this.options[c]=b[c]}.bind(this))},getOptions:function(){return this.options},initCommands:function(b){var d=this.options.commandSpanId,c=this.options.commandService;
if(c&&d){var e=new l.Command({name:g["Copy current change from right to left"],tooltip:g["Copy current change from right to left"],imageClass:"core-sprite-leftarrow",id:"orion.compare.copyToLeft",groupId:"orion.compareGroup",visibleWhen:function(a){return"twoWay"===b.type&&!b.getImageMode()&&b.options.newFile&&!b.options.newFile.readonly}.bind(this),callback:function(a){a.items.copyToLeft()}}),a=new l.Command({name:g["Copy current change from left to right"],tooltip:g["Copy current change from left to right"],
imageClass:"core-sprite-rightarrow",id:"orion.compare.copyToRight",groupId:"orion.compareGroup",visibleWhen:function(a){return"twoWay"===b.type&&!b.getImageMode()&&b.options.oldFile&&!b.options.oldFile.readonly}.bind(this),callback:function(a){a.items.copyToRight()}}),h=new l.Command({tooltip:g["Switch to unified diff"],name:g.Unified,id:"orion.compare.toggle2Inline",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.toggler&&"twoWay"===a.options.toggler.getWidget().type},callback:function(a){a.items.options.toggler.toggle()}}),
q=new l.Command({tooltip:g["Switch to side by side diff"],name:g["Side by side"],id:"orion.compare.toggle2TwoWay",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.toggler&&"inline"===a.options.toggler.getWidget().type},callback:function(a){a.items.options.toggler.toggle()}}),s=new l.Command({name:g["Next diff block"],tooltip:g["Next diff block"],imageClass:"core-sprite-move-down",id:"orion.compare.nextDiff",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},
callback:function(a){a.items.nextDiff()}}),t=new l.Command({name:g["Previous diff block"],tooltip:g["Previous diff block"],imageClass:"core-sprite-move-up",id:"orion.compare.prevDiff",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},callback:function(a){a.items.prevDiff()}}),y=new l.Command({name:g["Next diff change"],tooltip:g["Next diff change"],imageClass:"core-sprite-move-down",id:"orion.compare.nextChange",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},
callback:function(a){a.items.nextChange()}}),u=new l.Command({name:g["Previous diff change"],tooltip:g["Previous diff change"],imageClass:"core-sprite-move-up",id:"orion.compare.prevChange",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},callback:function(a){a.items.prevChange(a)}});c.addCommand(e);c.addCommand(a);c.addCommand(q);c.addCommand(h);c.addCommand(s);c.addCommand(t);c.addCommand(y);c.addCommand(u);c.registerCommandContribution(d,"orion.compare.toggle2Inline",
108);c.registerCommandContribution(d,"orion.compare.toggle2TwoWay",109);c.registerCommandContribution(d,"orion.compare.copyToLeft",110,null,!1,new k.KeyBinding(37,!0,!1,!0));c.registerCommandContribution(d,"orion.compare.copyToRight",111,null,!1,new k.KeyBinding(39,!0,!1,!0));c.registerCommandContribution(d,"orion.compare.nextDiff",112,null,!1,new k.KeyBinding(40,!0));c.registerCommandContribution(d,"orion.compare.prevDiff",113,null,!1,new k.KeyBinding(38,!0));b.options.wordLevelNav?(c.registerCommandContribution(d,
"orion.compare.nextChange",114,null,!1,new k.KeyBinding(40,!0,!0)),c.registerCommandContribution(d,"orion.compare.prevChange",115,null,!1,new k.KeyBinding(38,!0,!0))):(c.registerCommandContribution(d,"orion.compare.nextChange",114,null,!0,new k.KeyBinding(40,!0,!0)),c.registerCommandContribution(d,"orion.compare.prevChange",115,null,!0,new k.KeyBinding(38,!0,!0)))}},renderCommands:function(b){var d=this.options.commandSpanId,c=this.options.commandService;c&&d&&(e.empty(e.node(d)),this.options.gridRenderer&&
this.options.gridRenderer.navGridHolder?(this.options.gridRenderer.navGridHolder.splice(0,this.options.gridRenderer.navGridHolder.length),this.options.gridRenderer.additionalCmdRender?this.options.gridRenderer.before?(this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder),c.renderCommands(d,d,b,b,"tool",null,this.options.gridRenderer.navGridHolder)):(c.renderCommands(d,d,b,b,"tool",null,this.options.gridRenderer.navGridHolder),this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder)):
c.renderCommands(d,d,b,b,"tool",null,this.options.gridRenderer.navGridHolder)):c.renderCommands(d,d,b,b,"tool",null))}};return d}();return d});
define("orion/compare/diffProvider",["i18n!orion/compare/nls/messages","orion/Deferred"],function(g,l){function k(d,e,b){var f=new l;d[e].apply(d,b).then(function(b){f.resolve(b)},function(b){f.reject(b)});return f}function e(d,e){var b=d.getServiceReferences("orion.core.diff"),f,c=b;if(e){c=[];for(f=0;f<b.length;++f)e(b[f])&&c.push(b[f])}var m=[],a=[];for(f=0;f<c.length;++f)m[f]=RegExp(c[f].getProperty("pattern")||".*"),a[f]=d.getService(c[f]);this._getService=function(b){if(-1===b.indexOf("://")){var c=
document.createElement("a");c.href=b;b=c.href}for(c=0;c<m.length;++c)if(m[c].test(b))return a[c];throw g["No Matching DiffService for location:"]+b;}}e.prototype={getDiffContent:function(d){return k(this._getService(d),"getDiffContent",arguments)},getDiffFileURI:function(d){return k(this._getService(d),"getDiffFileURI",arguments)}};return{DiffProvider:e}});
define("orion/compare/diffParser",[],function(){var g=g||{};g.DiffParser=function(){function g(e,d){this._lineDelimiter=e?e:k?"\r\n":"\n";this._diffLineDelimiter=d?d:this._lineDelimiter;this._DEBUG=!1}var k=-1!==window.navigator.platform.indexOf("Win");g.prototype={_init:function(){this._oFileContents=[];this._diffContents=[];this._oBlocks=[];this._nBlocks=[];this._hunkRanges=[];this._lastToken=" ";this._deltaMap=[];this._nFileContents=[];this._nNewLineAtEnd=this._oNewLineAtEnd=!0;this._diffContentIndex=
1},setLineDelim:function(e){this._diffLineDelimiter=this._lineDelimiter=e},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(e,d,h,b){this._init();if(""===d)return{outPutFile:e,mapper:[]};this._oFileContents=""===e?[]:e.split(this._lineDelimiter);this._diffContents=d.split(this._diffLineDelimiter);d=this._diffContents.length;this._hunkRanges=[];for(var f=0;f<d;f++){var c=this._parseHunkRange(f);c&&this._hunkRanges.push(c)}if(0===this._hunkRanges.length)return{outPutFile:e,
mapper:[]};this._DEBUG&&(console.log("***Diff contents: \n"),this._diffContents.forEach(function(b){console.log(b)}),console.log("***Hunk ranges: \n"),console.log(JSON.stringify(this._hunkRanges)));for(e=0;e<this._hunkRanges.length;e++)this._parseHunkBlock(e);this._DEBUG&&(console.log("***Original Hunk range blocks: \n"),console.log(JSON.stringify(this._oBlocks)),console.log("***New Hunk range blocks: \n"),console.log(JSON.stringify(this._nBlocks)));this._buildMap(h);this._DEBUG&&(console.log("***New Line at end of file(original): \n"),
console.log(JSON.stringify(this._oNewLineAtEnd)),console.log("***New Line at end of file(new): \n"),console.log(JSON.stringify(this._nNewLineAtEnd)),console.log("***Mapper: \n"),this._logMap(),console.log("***Total line number in original file: "+this._oFileContents.length));b||this._buildNewFile();return{outPutFile:this._nFileContents.join(this._diffLineDelimiter),mapper:this._deltaMap}},_logMap:function(){for(var e=0;e<this._deltaMap.length;e++)if(console.log(JSON.stringify(this._deltaMap[e])),
0<this._deltaMap[e][2]){console.log("    **Diff content on change/add: \n");for(var d=0;d<this._deltaMap[e][0];d++)console.log("    "+this._diffContents[this._deltaMap[e][2]+d-1])}},_logNewFile:function(){for(var e=0;e<this._nFileContents.length;e++)console.log(this._nFileContents[e])},_createBlock:function(e,d,h,b){b===h&&" "===e||(h=[h,b-h,"s"],"-"===e?h[2]="r":"+"===e?h[2]="a":"c"===e&&(h[2]="c"),d.push(h))},_createMinusBlock:function(e,d,h){var b=this._oBlocks.length;0===b||e!==this._oBlocks[b-
1][0]?(this._oBlocks.push([0===e?1:e,h]),this._nBlocks.push([d,0,-2])):this._oBlocks[b-1][1]+=h},_createPlusBlock:function(e,d,h,b){var f=this._nBlocks.length;0===f||d!==this._nBlocks[f-1][0]?(this._oBlocks.push([0===e?1:e,0]),this._nBlocks.push([d,h,b])):(this._nBlocks[f-1][1]+=h,this._nBlocks[f-1][2]=b)},_parseHunkBlock:function(e){for(var d=" ",h=this._hunkRanges[e][0]+1,b=e===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[e+1][0],f=0,c=0,g=this._hunkRanges[e][1],a=this._hunkRanges[e][3],
n=h,q=h;q<b;q++)if(0!==this._diffContents[q].length){var k=this._diffContents[q][0];if("\\"===k&&("\\ No newline at end of file"===this._diffContents[q].substring(0,this._diffContents[q].length-1)||"\\ No newline at end of file"===this._diffContents[q]))"-"===d?this._oNewLineAtEnd=!1:" "===d?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,q>h&&"\r"===this._diffContents[q-1][this._diffContents[q-1].length-1]&&(this._diffContents[q-1]=this._diffContents[q-1].substring(0,this._diffContents[q-
1].length-1));else{switch(k){case "-":case "+":case " ":break;default:continue}if(d!==k){"+"===k&&(n=q);switch(d){case " ":g=this._hunkRanges[e][1]+f;a=this._hunkRanges[e][3]+c;break;case "-":this._createMinusBlock(g,a,this._hunkRanges[e][1]+f-g);break;case "+":this._createPlusBlock(g,a,this._hunkRanges[e][3]+c-a,n)}d=k}switch(k){case "-":f++;break;case "+":c++;break;case " ":f++,c++}}}switch(d){case "-":this._createMinusBlock(g,a,this._hunkRanges[e][1]+f-g);break;case "+":this._createPlusBlock(g,
a,this._hunkRanges[e][3]+c-a,n)}},_detectConflictes:function(e,d){if(0>e)return!1;for(var h=e+d,b=e;b<h;b++){var f=this._diffContents[b];if(-1<f.indexOf("\x3c\x3c\x3c\x3c\x3c")||-1<f.indexOf("\x3e\x3e\x3e\x3e\x3e"))return!0}return!1},_buildMap:function(e){var d=this._oBlocks.length,h=this._oFileContents.length,b=0,f;f=1;for(var c=0;c<d;c++)f=this._oBlocks[c][0]-f,0<f&&(this._deltaMap.push([f,f,0]),b+=f),e&&this._detectConflictes(this._nBlocks[c][2],this._nBlocks[c][1])?this._deltaMap.push([this._nBlocks[c][1],
this._oBlocks[c][1],this._nBlocks[c][2]+1,1]):this._deltaMap.push([this._nBlocks[c][1],this._oBlocks[c][1],this._nBlocks[c][2]+1]),b+=this._oBlocks[c][1],f=this._oBlocks[c][0]+this._oBlocks[c][1];0<h-f&&(this._deltaMap.push([h-f+1,h-f+1,0]),b+=h-f+1);b<h&&(f=h-b,e=this._deltaMap[this._deltaMap.length-1],0===e[2]?(e[0]+=f,e[1]+=f):-1===e[2]?this._deltaMap.push([f,f,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([f,f,0]):(this._nNewLineAtEnd&&(e[0]+=f),this._oNewLineAtEnd&&(e[1]+=
f)))},_buildNewFile:function(){var e=1,d=!1,h=this._deltaMap.length,b,f;for(b=0;b<h;b++){d=!1;if(0===this._deltaMap[b][2]){for(f=0;f<this._deltaMap[b][0];f++)this._nFileContents.push(this._oFileContents[e+f-1]);d=!0}else if(0<this._deltaMap[b][2])for(f=0;f<this._deltaMap[b][0];f++)this._nFileContents.push(this._diffContents[this._deltaMap[b][2]+f-1].substring(1));e+=this._deltaMap[b][1]}this._nNewLineAtEnd&&!d&&this._nFileContents.push("")},_converHRangeBody:function(e,d){if(e){var h=parseInt(e,10);
d.push(0<=h?h:1)}else d.push(1)},_parseHunkRange:function(e){var d=this._diffContents[e],h=/^@@\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,b=/^@@\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/.exec(d),f=null;if(b&&5===b.length)f=[e],this._converHRangeBody(b[1],f),this._converHRangeBody(b[2],f),this._converHRangeBody(b[3],f),this._converHRangeBody(b[4],f);else if((b=h.exec(d))&&5===b.length)f=[e],this._converHRangeBody(b[3],f),this._converHRangeBody(b[4],
f),this._converHRangeBody(b[1],f),this._converHRangeBody(b[2],f);return f}};return g}();return g});
define("orion/compare/compareRulers",["orion/compare/compareUtils"],function(g){var l=l||{};l.CompareRuler=function(){function g(e,d,h){this._location=e||"left";this._overview=d||"page";this._rulerStyle=h;this._editor=null;var b=this;this._listener={onModelChanged:function(d){b._onModelChanged(d)}}}g.prototype={setView:function(e){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=e;this._onModelChanged&&this._editor&&this._editor.addEventListener("ModelChanged",
this._listener.onModelChanged)},getLocation:function(){return this._location},getOverview:function(e){return this._overview},getAnnotationModel:function(){return null},addAnnotationType:function(e){},isAnnotationTypeVisible:function(e){return!1},removeAnnotationType:function(e){},setAnnotationModel:function(e){},getAnnotations:function(e,d){for(var h=[],b=e;b<d;b++){var f=this.getStyle(b);f&&(h[b]={html:this.getHTML(b),style:f})}return h},getWidestAnnotation:function(){return{html:this.getHTML(-1),
style:this.getStyle(-1)}},getRulerStyle:function(){return this.getStyle(void 0)}};return g}();l.LineNumberCompareRuler=function(){function g(e,d,h,b,f,c){l.CompareRuler.call(this,h,"page",b);this._diffNavigator=e;this._oddStyle=f||{style:{backgroundColor:"white"}};this._evenStyle=c||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=d}g.prototype=new l.CompareRuler;g.prototype.getStyle=function(e){return void 0===e?this._rulerStyle:this._evenStyle};g.prototype.getHTML=function(e){var d=
this._editor.getModel(),h=this._diffNavigator.getFeeder(0===this._mapperColumnIndex);return!h?"":-1===e?d.getLineCount():h.getLineNumber?(e=h.getLineNumber(e),-1===e?"":e+1):e+1};g.prototype._onModelChanged=function(e){var d=e.start,h=this._editor.getModel();e=h.getLineCount();var b=(e+"").length;this._numOfDigits!==b&&(this._numOfDigits=b,d=h.getLineAtOffset(d),this._editor.redrawLines(d,e,this))};return g}();l.CompareOverviewRuler=function(){function k(e,d,h,b){this._diffNavigator=h;this._onClick=
b;l.CompareRuler.call(this,e,"document",d)}k.prototype=new l.CompareRuler;k.prototype.getStyle=function(e){var d,h;if(void 0===e)d=this._rulerStyle||{},h=d.style||(d.style={}),h.lineHeight="1px",h.fontSize="1px",h.width="14px";else if(d=-1!==e?{styleClass:"annotationOverview breakpoint"}:{},h=d.style||(d.style={}),h.cursor="pointer",h.width="8px",h.left="2px",0<=e){var b;if(this._diffNavigator&&this._diffNavigator.getFeeder())b=this._diffNavigator.getFeeder().getDiffBlocks();else return null;e=g.getAnnotationIndex(b,
e);if(-1===e)return null;b=g.getAnnotationMapperIndex(b,e);var f;f=this._diffNavigator.getMapper();if(b=g.isMapperConflict(f,b))h.border="1px #FF0000 solid";e===this._diffNavigator.getCurrentBlockIndex()&&(h.backgroundColor=b?"red":"blue");e=this._diffNavigator.getFeeder().getDiffBlockH(e);b=this._diffNavigator.getFeeder().getOverviewLineCount();if(0>e)return null;f=this._editor.getClientArea();e=Math.floor(f.height*e/b);2>e&&(e=2);h.height=e+"px"}else return null;return d};k.prototype.setDiffNavigator=
function(e){this._diffNavigator=e};k.prototype.getHTML=function(e){return"\x26nbsp;"};k.prototype.onClick=function(e,d){void 0!==e&&this._onClick(e,this)};k.prototype._onModelChanged=function(e){0<this._editor.getModel().getLineCount()&&this._editor.redrawLines(0,1,this)};return k}();l.CompareCurveRuler=function(){function k(e){this._canvasDiv=e;this._mapper=void 0}k.prototype={init:function(e,d,h,b){this._rightIniting=this._rightIniting=this._leftIniting=!0;this._mapper=e;this._leftEditor=d;this._rightEditor=
h;this._leftTextView=d.getTextView();this._rightTextView=h.getTextView();this._diffNavigator=b;this.render()},matchPositionFrom:function(e){var d=e?this._leftTextView:this._rightTextView,h=e?this._rightTextView:this._leftTextView,b=d.getTopIndex(),d=d.getBottomIndex();e=g.matchMapper(this._mapper,e?0:1,b,d);h.setTopIndex(e)},copyTo:function(e){if(this._diffNavigator.iterator){var d=this._diffNavigator.iterator.cursor();if(d&&("word"===d.type?!d.copied&&!d.parent.copied:!d.copied)){var h=e?this._rightTextView.getText(d.oldA.start,
d.oldA.end):this._leftTextView.getText(d.newA.start,d.newA.end),b=e?d.newA:d.oldA;(e?this._leftTextView:this._rightTextView).setText(h,b.start,b.end);d.copied=!0}}},render:function(){if(this._mapper){var e=this._canvasDiv.getContext("2d");e.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);e.strokeStyle="#AAAAAA";e.lineWidth=1;e.beginPath();var d=this._leftTextView.getTopIndex(),h=this._leftTextView.getBottomIndex(),b=this._rightTextView.getTopIndex(),f=this._rightTextView.getBottomIndex();
this._leftLineH=this._leftTextView.getLineHeight();this._rightLineH=this._rightTextView.getLineHeight();for(var c=0,m=0,a=!1,n=0;n<this._mapper.length;n++){if(0!==this._mapper[n][2])if(g.overlapMapper(this._mapper[n],0,c,d,h)||g.overlapMapper(this._mapper[n],1,m,b,f))this._renderCurve(n,c,m,this._canvasDiv,e,d,h,b,f),a=!0;else if(a)break;c+=this._mapper[n][0];m+=this._mapper[n][1]}e.stroke()}},_renderCurve:function(e,d,h,b,f,c,g,a,n){c=this._mapper[e];d=this._leftTextView.getLinePixel(d+c[0]/2)+c[0]%
2*this._leftLineH/3-this._leftTextView.getTopPixel();h=this._rightTextView.getLinePixel(h+c[1]/2)+c[1]%2*this._rightLineH/3-this._rightTextView.getTopPixel();b=b.parentNode.clientWidth;e===this._diffNavigator.getCurrentMapperIndex()?(f.stroke(),f.strokeStyle="#000",f.lineWidth=1,f.beginPath(),f.moveTo(0,d),f.bezierCurveTo(b/3,d,0.666*b,h,b,h),f.stroke(),f.strokeStyle="#AAAAAA",f.lineWidth=1,f.beginPath()):(f.moveTo(0,d),f.bezierCurveTo(b/3,d,0.666*b,h,b,h),f.stroke())},onChanged:function(e,d){var h=
d?this._rightIniting:this._leftIniting;if(e.removedLineCount!==e.addedLineCount){var b=d?this._rightTextView:this._leftTextView;h||g.updateMapper(this._mapper,d?1:0,b.getModel().getLineAtOffset(e.start),e.removedLineCount,e.addedLineCount);(0<e.removedLineCount||0<e.addedLineCount)&&this.render()}d?this._rightIniting=!1:this._leftIniting=!1;return h}};return k}();return l});
define("orion/editor/i18n",{load:function(g,l,k,e){l.specified&&l.specified("orion/bootstrap")?l(["orion/i18n!"+g],function(d){k(d)}):k({})}});
define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",
pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",
selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",
deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",
setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",
findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",
collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",
viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",
vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",
viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",replaceAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",nothingReplaced:"Nothing replaced",notFound:"Not found"});
define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(g,l){var k={root:l},e;for(e in g)g.hasOwnProperty(e)&&"undefined"===typeof k[e]&&(k[e]=g[e]);return k});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(g,l,k){function e(d,e){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(d);this.setLineDelimiter(e)}e.prototype={destroy:function(){},find:function(d){1<this._text.length&&(this._text=[this._text.join("")]);var e=d.string,b=d.regex,f=e,c="",g=d.caseInsensitive;if(f)if(b){if(e=l.parse(f))f=e.pattern,c=e.flags}else f=e.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),g&&(f=f.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var a=null,n;if(f){var e=d.reverse,q=d.wrap,b=d.wholeWord,k=d.start||0;d=d.end;var t=null!==d&&void 0!==d;-1===c.indexOf("g")&&(c+="g");-1===c.indexOf("m")&&(c+="m");g&&-1===c.indexOf("i")&&(c+="i");b&&(f="\\b"+f+"\\b");var y=this._text[0],u,v,x=0;t&&(g=k<d?k:d,y=y.substring(g,k<d?d:k),x=g);var z=RegExp(f,c);e?n=function(){var a=null;for(z.lastIndex=0;;){v=z.lastIndex;u=z.exec(y);if(v===z.lastIndex)return null;if(u){if(!(u.index+x<k)){if(!q||a)break;k=y.length+x}a={start:u.index+
x,end:z.lastIndex+x}}else break}a&&(k=a.start);return a}:(t||(z.lastIndex=k),n=function(){for(;;){v=z.lastIndex;u=z.exec(y);if(v===z.lastIndex)break;if(u)return{start:u.index+x,end:z.lastIndex+x};if(!(0!==v&&q))break}return null});a=n()}return{next:function(){var b=a;b&&(a=n());return b},hasNext:function(){return null!==a}}},getCharCount:function(){for(var d=0,e=0;e<this._text.length;e++)d+=this._text[e].length;return d},getLine:function(d,e){var b=this.getLineCount();if(!(0<=d&&d<b))return null;
var f=this._lineOffsets[d];if(d+1<b){b=this.getText(f,this._lineOffsets[d+1]);if(e)return b;for(var f=b.length,c;10===(c=b.charCodeAt(f-1))||13===c;)f--;return b.substring(0,f)}return this.getText(f)},getLineAtOffset:function(d){var e=this.getCharCount();if(!(0<=d&&d<=e))return-1;var b=this.getLineCount();if(d===e)return b-1;var f,c,g=this._lastLineIndex;if(0<=g&&g<b&&(f=this._lineOffsets[g],c=g+1<b?this._lineOffsets[g+1]:e,f<=d&&d<c))return g;for(var a=b,n=-1;1<a-n;)if(g=Math.floor((a+n)/2),f=this._lineOffsets[g],
c=g+1<b?this._lineOffsets[g+1]:e,d<=f)a=g;else if(d<c){a=g;break}else n=g;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(d,e){var b=this.getLineCount();if(!(0<=d&&d<b))return-1;if(d+1<b){b=this._lineOffsets[d+1];if(e)return b;for(var f=this.getText(Math.max(this._lineOffsets[d],b-2),b),c=f.length,g;10===(g=f.charCodeAt(c-1))||13===g;)c--;return b-(f.length-c)}return this.getCharCount()},
getLineStart:function(d){return!(0<=d&&d<this.getLineCount())?-1:this._lineOffsets[d]},getText:function(d,e){void 0===d&&(d=0);void 0===e&&(e=this.getCharCount());if(d===e)return"";for(var b=0,f=0,c;f<this._text.length;){c=this._text[f].length;if(d<=b+c)break;b+=c;f++}for(var g=b,a=f;f<this._text.length;){c=this._text[f].length;if(e<=b+c)break;b+=c;f++}if(a===f)return this._text[a].substring(d-g,e-b);g=this._text[a].substring(d-g);b=this._text[f].substring(0,e-b);return g+this._text.slice(a+1,f).join("")+
b},onChanging:function(d){return this.dispatchEvent(d)},onChanged:function(d){return this.dispatchEvent(d)},setLineDelimiter:function(d,e){"auto"===d&&(d=void 0,1<this.getLineCount()&&(d=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=d?d:k.platformDelimiter;if(e){var b=this.getLineCount();if(1<b){for(var f=Array(b),c=0;c<b;c++)f[c]=this.getLine(c);this.setText(f.join(this._lineDelimiter))}}},setText:function(d,e,b){void 0===d&&(d="");void 0===e&&(e=0);void 0===b&&(b=
this.getCharCount());if(!(e===b&&""===d)){for(var f=this.getLineAtOffset(e),c=this.getLineAtOffset(b),g=e,a=b-e,n=c-f,q=d.length,k=0,l=this.getLineCount(),y=0,u=0,v=0,x=[];;){-1!==y&&y<=v&&(y=d.indexOf("\r",v));-1!==u&&u<=v&&(u=d.indexOf("\n",v));if(-1===u&&-1===y)break;v=-1!==y&&-1!==u?y+1===u?u+1:(y<u?y:u)+1:-1!==y?y+1:u+1;x.push(e+v);k++}this.onChanging({type:"Changing",text:d,start:g,removedCharCount:a,addedCharCount:q,removedLineCount:n,addedLineCount:k});0===x.length&&(v=this.getLineStart(f),
c=c+1<l?this.getLineStart(c+1):this.getCharCount(),e!==v&&(d=this.getText(v,e)+d,e=v),b!==c&&(d+=this.getText(b,c),b=c));v=q-a;for(c=f+n+1;c<l;c++)this._lineOffsets[c]+=v;if(5E4>x.length)f=[f+1,n].concat(x),Array.prototype.splice.apply(this._lineOffsets,f);else{v=f+1;this._lineOffsets.splice(v,n);for(l=0;l<x.length;l+=5E4)f=[v,0].concat(x.slice(l,Math.min(x.length,l+5E4))),Array.prototype.splice.apply(this._lineOffsets,f),v+=5E4}for(v=l=0;v<this._text.length;){c=this._text[v].length;if(e<=l+c)break;
l+=c;v++}f=l;for(x=v;v<this._text.length;){c=this._text[v].length;if(b<=l+c)break;l+=c;v++}c=this._text[v];e=this._text[x].substring(0,e-f);b=c.substring(b-l);x=[x,v-x+1];e&&x.push(e);d&&x.push(d);b&&x.push(b);Array.prototype.splice.apply(this._text,x);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:g,removedCharCount:a,addedCharCount:q,removedLineCount:n,addedLineCount:k})}}};g.EventTarget.addMixin(e.prototype);return{TextModel:e}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(g,l){function k(d){d&&(this._view=d,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function e(d){k.call(this,d)}k.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(d){for(var e=[],b=this._keyBindings,f=0;f<b.length;f++)b[f].actionID===d&&e.push(b[f].keyBinding);return e},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(d){if("keydown"===
d.type)switch(d.keyCode){case 16:case 17:case 18:case 91:return}for(var e=this._keyBindingIndex,b=this._matchingKeyBindings||this._keyBindings,f=[],c=0;c<b.length;c++){var g=b[c],a=g.keyBinding.match(d,e);if(!0===a)return this._keyBindingIndex=0,this._matchingKeyBindings=null,g.actionID;"number"===typeof a&&f.push(g)}if(0===f.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=f,"noop"},setKeyBinding:function(d,e){for(var b=this._keyBindings,
f=0;f<b.length;f++){var c=b[f];if(c.keyBinding.equals(d)){e?c.actionID=e:c.predefined?c.actionID="noop":b.splice(f,1);return}}e&&b.push({keyBinding:d,actionID:e})},setView:function(d){this._view=d}};e.prototype=new k;e.prototype.createKeyBindings=function(){var d=g.KeyBinding,e=[];e.push({actionID:"lineUp",keyBinding:new d(38),predefined:!0});e.push({actionID:"lineDown",keyBinding:new d(40),predefined:!0});e.push({actionID:"charPrevious",keyBinding:new d(37),predefined:!0});e.push({actionID:"charNext",
keyBinding:new d(39),predefined:!0});l.isMac?(e.push({actionID:"scrollPageUp",keyBinding:new d(33),predefined:!0}),e.push({actionID:"scrollPageDown",keyBinding:new d(34),predefined:!0}),e.push({actionID:"pageUp",keyBinding:new d(33,null,null,!0),predefined:!0}),e.push({actionID:"pageDown",keyBinding:new d(34,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new d(37,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(39,!0),predefined:!0}),e.push({actionID:"wordPrevious",
keyBinding:new d(37,null,null,!0),predefined:!0}),e.push({actionID:"wordNext",keyBinding:new d(39,null,null,!0),predefined:!0}),e.push({actionID:"scrollTextStart",keyBinding:new d(36),predefined:!0}),e.push({actionID:"scrollTextEnd",keyBinding:new d(35),predefined:!0}),e.push({actionID:"textStart",keyBinding:new d(38,!0),predefined:!0}),e.push({actionID:"textEnd",keyBinding:new d(40,!0),predefined:!0}),e.push({actionID:"scrollPageUp",keyBinding:new d(38,null,null,null,!0),predefined:!0}),e.push({actionID:"scrollPageDown",
keyBinding:new d(40,null,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new d(37,null,null,null,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(39,null,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new d(38,null,null,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(40,null,null,!0),predefined:!0})):(e.push({actionID:"pageUp",keyBinding:new d(33),predefined:!0}),e.push({actionID:"pageDown",keyBinding:new d(34),predefined:!0}),
e.push({actionID:"lineStart",keyBinding:new d(36),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d(35),predefined:!0}),e.push({actionID:"wordPrevious",keyBinding:new d(37,!0),predefined:!0}),e.push({actionID:"wordNext",keyBinding:new d(39,!0),predefined:!0}),e.push({actionID:"textStart",keyBinding:new d(36,!0),predefined:!0}),e.push({actionID:"textEnd",keyBinding:new d(35,!0),predefined:!0}));l.isFirefox&&l.isLinux&&(e.push({actionID:"lineUp",keyBinding:new d(38,!0),predefined:!0}),e.push({actionID:"lineDown",
keyBinding:new d(40,!0),predefined:!0}));l.isWindows&&(e.push({actionID:"scrollLineUp",keyBinding:new d(38,!0),predefined:!0}),e.push({actionID:"scrollLineDown",keyBinding:new d(40,!0),predefined:!0}));e.push({actionID:"selectLineUp",keyBinding:new d(38,null,!0),predefined:!0});e.push({actionID:"selectLineDown",keyBinding:new d(40,null,!0),predefined:!0});e.push({actionID:"selectCharPrevious",keyBinding:new d(37,null,!0),predefined:!0});e.push({actionID:"selectCharNext",keyBinding:new d(39,null,!0),
predefined:!0});e.push({actionID:"selectPageUp",keyBinding:new d(33,null,!0),predefined:!0});e.push({actionID:"selectPageDown",keyBinding:new d(34,null,!0),predefined:!0});l.isMac?(e.push({actionID:"selectLineStart",keyBinding:new d(37,!0,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(39,!0,!0),predefined:!0}),e.push({actionID:"selectWordPrevious",keyBinding:new d(37,null,!0,!0),predefined:!0}),e.push({actionID:"selectWordNext",keyBinding:new d(39,null,!0,!0),predefined:!0}),
e.push({actionID:"selectTextStart",keyBinding:new d(36,null,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new d(35,null,!0),predefined:!0}),e.push({actionID:"selectTextStart",keyBinding:new d(38,!0,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new d(40,!0,!0),predefined:!0}),e.push({actionID:"selectLineStart",keyBinding:new d(37,null,!0,null,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(39,null,!0,null,!0),predefined:!0}),e.push({actionID:"selectLineStart",
keyBinding:new d(38,null,!0,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(40,null,!0,!0),predefined:!0})):(l.isLinux&&(e.push({actionID:"selectWholeLineUp",keyBinding:new d(38,!0,!0),predefined:!0}),e.push({actionID:"selectWholeLineDown",keyBinding:new d(40,!0,!0),predefined:!0})),e.push({actionID:"selectLineStart",keyBinding:new d(36,null,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new d(35,null,!0),predefined:!0}),e.push({actionID:"selectWordPrevious",
keyBinding:new d(37,!0,!0),predefined:!0}),e.push({actionID:"selectWordNext",keyBinding:new d(39,!0,!0),predefined:!0}),e.push({actionID:"selectTextStart",keyBinding:new d(36,!0,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new d(35,!0,!0),predefined:!0}));e.push({actionID:"undo",keyBinding:new g.KeyBinding("z",!0),predefined:!0});l.isMac?e.push({actionID:"redo",keyBinding:new g.KeyBinding("z",!0,!0),predefined:!0}):e.push({actionID:"redo",keyBinding:new g.KeyBinding("y",!0),predefined:!0});
e.push({actionID:"deletePrevious",keyBinding:new d(8),predefined:!0});e.push({actionID:"deletePrevious",keyBinding:new d(8,null,!0),predefined:!0});e.push({actionID:"deleteNext",keyBinding:new d(46),predefined:!0});e.push({actionID:"deleteWordPrevious",keyBinding:new d(8,!0),predefined:!0});e.push({actionID:"deleteWordPrevious",keyBinding:new d(8,!0,!0),predefined:!0});e.push({actionID:"deleteWordNext",keyBinding:new d(46,!0),predefined:!0});e.push({actionID:"tab",keyBinding:new d(9),predefined:!0});
e.push({actionID:"shiftTab",keyBinding:new d(9,null,!0),predefined:!0});e.push({actionID:"enter",keyBinding:new d(13),predefined:!0});e.push({actionID:"enter",keyBinding:new d(13,null,!0),predefined:!0});e.push({actionID:"selectAll",keyBinding:new d("a",!0),predefined:!0});e.push({actionID:"toggleTabMode",keyBinding:new d("m",!0),predefined:!0});l.isMac&&(e.push({actionID:"deleteNext",keyBinding:new d(46,null,!0),predefined:!0}),e.push({actionID:"deleteWordPrevious",keyBinding:new d(8,null,null,!0),
predefined:!0}),e.push({actionID:"deleteWordNext",keyBinding:new d(46,null,null,!0),predefined:!0}));e.push({actionID:"toggleWrapMode",keyBinding:new g.KeyBinding("w",!0,!1,!0)});e.push({actionID:"toggleOverwriteMode",keyBinding:new g.KeyBinding(45)});if(!l.isFirefox){var b=l.isMac&&l.isChrome;e.push({actionID:"noop",keyBinding:new d("u",!b,!1,!1,b),predefined:!0});e.push({actionID:"noop",keyBinding:new d("i",!b,!1,!1,b),predefined:!0});e.push({actionID:"noop",keyBinding:new d("b",!b,!1,!1,b),predefined:!0})}l.isFirefox&&
(e.push({actionID:"copy",keyBinding:new d(45,!0),predefined:!0}),e.push({actionID:"paste",keyBinding:new d(45,null,!0),predefined:!0}),e.push({actionID:"cut",keyBinding:new d(46,null,!0),predefined:!0}));l.isMac&&(e.push({actionID:"lineStart",keyBinding:new d("a",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new d("e",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineUp",keyBinding:new d("p",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineDown",keyBinding:new d("n",!1,!1,
!1,!0),predefined:!0}),e.push({actionID:"charPrevious",keyBinding:new d("b",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"charNext",keyBinding:new d("f",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deletePrevious",keyBinding:new d("h",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteNext",keyBinding:new d("d",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteLineEnd",keyBinding:new d("k",!1,!1,!1,!0),predefined:!0}),l.isFirefox?(e.push({actionID:"scrollPageDown",keyBinding:new d("v",!1,
!1,!1,!0),predefined:!0}),e.push({actionID:"deleteLineStart",keyBinding:new d("u",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteWordPrevious",keyBinding:new d("w",!1,!1,!1,!0),predefined:!0})):(e.push({actionID:"pageDown",keyBinding:new d("v",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"centerLine",keyBinding:new d("l",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"enterNoCursor",keyBinding:new d("o",!1,!1,!1,!0),predefined:!0})));return e};return{KeyMode:k,DefaultKeyMode:e}});
define("orion/editor/util",[],function(){return{contains:function(g,l){if(!l)return!1;if(!g.compareDocumentPosition){for(var k=l;k;){if(g===k)return!0;k=k.parentNode}return!1}return g===l||0!==(g.compareDocumentPosition(l)&16)},addEventListener:function(g,l,k,e){"function"===typeof g.addEventListener?g.addEventListener(l,k,!0===e):g.attachEvent("on"+l,k)},removeEventListener:function(g,l,k,e){"function"===typeof g.removeEventListener?g.removeEventListener(l,k,!0===e):g.detachEvent("on"+l,k)}}});
define("orion/editor/textView","i18n!orion/editor/nls/messages orion/editor/textModel orion/editor/keyModes orion/editor/eventTarget orion/editor/textTheme orion/editor/util orion/util".split(" "),function(g,l,k,e,d,h,b){function f(a,c,d){if(d){c.className="";d=c.attributes;for(var e=d.length;0<e--;)(!b.isIE||9<=b.isIE||9>b.isIE&&d[e].specified)&&c.removeAttribute(d[e].name)}if(a){a.styleClass&&(c.className=a.styleClass);if(d=a.style)for(var f in d)d.hasOwnProperty(f)&&(c.style[f]=d[f]);if(a=a.attributes)for(var h in a)a.hasOwnProperty(h)&&
c.setAttribute(h,a[h])}}function c(a){return a instanceof Array?a.slice(0):a}function m(a,b){if(!a)return b;if(!b)return a;for(var c in b)b.hasOwnProperty(c)&&(a.hasOwnProperty(c)||(a[c]=b[c]));return a}function a(b,c){if(b===c)return!0;if(b&&!c||!b&&c||b&&b.constructor===String||c&&c.constructor===String)return!1;if(b instanceof Array||c instanceof Array){if(!(b instanceof Array&&c instanceof Array)||b.length!==c.length)return!1;for(var d=0;d<b.length;d++)if(!a(b[d],c[d]))return!1;return!0}if(!(b instanceof
Object)||!(c instanceof Object))return!1;for(d in b)if(b.hasOwnProperty(d)&&(!c.hasOwnProperty(d)||!a(b[d],c[d])))return!1;for(d in c)if(!b.hasOwnProperty(d))return!1;return!0}function n(a,b,c){for(var d=0,e=0,f=0,h=a.length;f<h;){-1!==d&&d<=f&&(d=a.indexOf("\r",f));-1!==e&&e<=f&&(e=a.indexOf("\n",f));var g=f,m;if(-1===e&&-1===d){b(a.substring(f));break}-1!==d&&-1!==e?d+1===e?(m=d,f=e+1):(m=d<e?d:e,f=(d<e?d:e)+1):-1!==d?(m=d,f=d+1):(m=e,f=e+1);b(a.substring(g,m));c()}}function q(a){var b,c,d,e,f=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;f.getComputedStyle?(a=f.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),c=a.getPropertyValue("padding-top"),d=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom")):a.currentStyle&&(b=a.currentStyle.paddingLeft,c=a.currentStyle.paddingTop,d=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom);return{left:parseInt(b,10)||0,top:parseInt(c,10)||0,right:parseInt(d,10)||0,bottom:parseInt(e,10)||0}}function s(a){var b,
c,d,e,f=a._trim;if(!f){var f=q(a),h=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;h.getComputedStyle?(e=h.getComputedStyle(a,null),b=e.getPropertyValue("border-left-width"),c=e.getPropertyValue("border-top-width"),d=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width")):a.currentStyle&&(b=a.currentStyle.borderLeftWidth,c=a.currentStyle.borderTopWidth,d=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth);b=parseInt(b,10)||0;c=parseInt(c,10)||
0;d=parseInt(d,10)||0;e=parseInt(e,10)||0;f.left+=b;f.top+=c;f.right+=d;f.bottom+=e;a._trim=f}return f}function t(a,b,c,d){function e(b){if(b.animationName===h){var c=b.target;"function"===typeof c.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){c.__DOMReady()},0)}}function f(a,b){for(var c=["","-webkit-","-moz-","-ms-","-o-"],d="",e="body ."+a+" {\n",p=0;p<c.length;p++)d+="@"+c[p]+"keyframes "+b+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",e+=c[p]+"animation-duration: 0.001s;\n"+
c[p]+"animation-name: "+b+";\n";return d+(e+"}")}c="_"+c+"DOMReady";b.className=b.className?b.className+" "+c:c;b.__DOMReady=d;d=c+"Style";if(!a.getElementById(d)){var h=c+"Animation";a.addEventListener("animationstart",e,!1);a.addEventListener("MSAnimationStart",e,!1);a.addEventListener("webkitAnimationStart",e,!1);b=a.createElement("style");b.id=d;d=a.getElementsByTagName("head")[0]||a.documentElement;b.appendChild(a.createTextNode(f(c,h)));d.insertBefore(b,d.firstChild)}}function y(a,b,c){this.start=
a;this.end=b;this.caret=c}function u(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function v(a,b,c){this.view=a;this.lineIndex=b;this._lineDiv=c}function x(a){this._init(a||{})}var z=h.addEventListener,A=h.removeEventListener,C=function(){function a(b){this.options=b}a.prototype.play=function(){var a="number"===typeof this.options.duration?this.options.duration:350,b=this.options.easing||this.defaultEasing,c=this.options.onAnimate||function(){},d=this.options.curve[0],
e=this.options.curve[1],f=e-d,p=-1,h,g=this;this.interval=this.options.window.setInterval(function(){p=-1===p?(new Date).getTime():p;var m=((new Date).getTime()-p)/a;1>m?(m=b(m),h=d+m*f,c(h)):(c(e),g.stop())},"number"===typeof this.options.rate?this.options.rate:20)};a.prototype.stop=function(){this.options.window.clearInterval(this.interval);(this.options.onEnd||function(){})()};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();y.prototype={clone:function(){return new y(this.start,
this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?this.start=a:this.end=a;this.start>this.end&&(a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret)},setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start\x3d"+this.start+" end\x3d"+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===
this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};u.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};v.prototype={create:function(a,b){if(!this._lineDiv){var c=this._lineDiv=this._createLine(a,b,this.lineIndex);c._line=this;return c}},_createLine:function(c,d,e){var h=this.view,g=h._model,m=g.getLine(e),n=g.getLineStart(e),q={type:"LineStyle",textView:h,lineIndex:e,lineText:m,
lineStart:n};h.onLineStyle(q);var k=c.ownerDocument,g=d||b.createElement(k,"div");if(!d||!a(d.viewStyle,q.style))f(q.style,g,d),d&&(d._trim=null),g.viewStyle=q.style,g.setAttribute("role","presentation");g.lineIndex=e;if(d&&g.viewLineText===m&&a(q.ranges,g.viewRanges))return g;g.viewRanges=q.ranges;g.viewLineText=m;e=[];this._createRanges(q.ranges,m,0,m.length,n,{tabOffset:0,ranges:e});q=" ";!h._fullSelection&&9>b.isIE&&(q="\ufeff");h={text:q,style:h._metrics.largestFontStyle,ignoreChars:1};0===e.length||
!e[e.length-1].style||"div"!==e[e.length-1].style.tagName?e.push(h):e.splice(e.length-1,0,h);var l,s,t,u=q=0;if(b.isFirefox&&2E3<m.length){d&&(g.innerHTML="",d.lineWidth=void 0);d=k.createDocumentFragment();for(m=0;m<e.length;m++)h=e[m],n=h.text,l=h.style,l=this._createSpan(g,n,l,h.ignoreChars),d.appendChild(l);g.appendChild(d)}else{var A,y;if(d){if(s=d.modelChangedEvent)0===s.removedLineCount&&0===s.addedLineCount?(y=s.start-n,A=s.addedCharCount-s.removedCharCount):y=-1,d.modelChangedEvent=void 0;
s=d.firstChild}for(m=0;m<e.length;m++){h=e[m];n=h.text;q+=n.length;l=h.style;if(s)if(t=s.firstChild.data,k=s.viewStyle,t===n&&a(l,k)){u+=t.length;s._rectsCache=void 0;l=s=s.nextSibling;continue}else for(;s;){if(-1!==y){k=q;k>=y&&(k-=A);t=(t=s.firstChild.data)?t.length:0;if(u+t>k)break;u+=t}k=s.nextSibling;g.removeChild(s);s=k}l=this._createSpan(g,n,l,h.ignoreChars);s?g.insertBefore(l,s):g.appendChild(l);d&&(d.lineWidth=void 0)}if(d)for(A=l?l.nextSibling:null;A;)k=A.nextSibling,d.removeChild(A),A=
k}g.parentNode||c.appendChild(g);return g},_createRanges:function(b,c,d,e,f,h){if(!(d>e)){if(b)for(var g=0;g<b.length;g++){var m=b[g];if(!(m.end<f+d)){var n=Math.max(f+d,m.start)-f;if(n>e)break;var q=Math.min(f+e,m.end)-f;if(n<=q){n=Math.max(d,n);q=Math.min(e,q);d<n&&this._createRange(c,d,n,null,h);if(!m.style||!m.style.unmergeable)for(;g+1<b.length&&b[g+1].start-f===q&&a(m.style,b[g+1].style);)m=b[g+1],q=Math.min(f+e,m.end)-f,g++;this._createRange(c,n,q,m.style,h);d=q}}}d<e&&this._createRange(c,
d,e,null,h)}},_createRange:function(a,b,c,d,e){if(!(b>c)){var f=this.view._customTabSize;if(f&&8!==f)for(var h=a.indexOf("\t",b);-1!==h&&h<c;){b<h&&(b={text:a.substring(b,h),style:d},e.ranges.push(b),e.tabOffset+=b.text.length);b=f-e.tabOffset%f;if(0<b){for(var g="\u00a0",m=1;m<b;m++)g+=" ";b={text:g,style:d,ignoreChars:b-1};e.ranges.push(b);e.tabOffset+=b.text.length}b=h+1;if(b===c)return;h=a.indexOf("\t",b)}b<=c&&(b={text:a.substring(b,c),style:d},e.ranges.push(b),e.tabOffset+=b.text.length)}},
_createSpan:function(a,c,d,e){var h=this.view,g="span";d&&d.tagName&&(g=d.tagName.toLowerCase());var m="a"===g;m&&(this.hasLink=!0);m&&!h._linksVisible&&(g="span");m=a.ownerDocument;a=b.createElement(a.ownerDocument,g);a.appendChild(m.createTextNode(d&&d.text?d.text:c));d&&d.html?(a.innerHTML=d.html,a.ignore=!0):d&&d.node&&(a.appendChild(d.node),a.ignore=!0);f(d,a);if("a"===g){var n=h._getWindow();z(a,"click",function(a){return h._handleLinkClick(a?a:n.event)},!1)}a.viewStyle=d;e&&(a.ignoreChars=
e);return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,c){var d=this._ensureCreated(),e=this.view;if(void 0===a)return this._getLineBoundingClientRect(d,!0);var f=e._model,h=d.ownerDocument,g=this.lineIndex,m=null;if(a<f.getLineEnd(g)){var n=f.getLineStart(g);this.forEach(function(c){var f=c.firstChild,g=this._nodeLength(c);if(n+g>a){var w=a-n;if(1===f.length)m=new u(c.getBoundingClientRect());
else if(e._isRangeRects)g=h.createRange(),g.setStart(f,w),g.setEnd(f,w+1),m=new u(g.getBoundingClientRect());else if(b.isIE)g=h.body.createTextRange(),g.moveToElementText(c),g.collapse(),(f=0===w&&8===b.isIE)&&(w=1),g.moveEnd("character",w+1),g.moveStart("character",w),m=new u(g.getBoundingClientRect()),f&&(m.left=c.getClientRects()[0].left);else{var q=f.data;c.removeChild(f);c.appendChild(h.createTextNode(q.substring(0,w)));var k=b.createElement(h,"span");k.appendChild(h.createTextNode(q.substring(w,
w+1)));c.appendChild(k);c.appendChild(h.createTextNode(q.substring(w+1)));m=new u(k.getBoundingClientRect());c.innerHTML="";c.appendChild(f);this._createdDiv||(c=e._getSelection(),(n<=c.start&&c.start<n+g||n<=c.end&&c.end<n+g)&&e._updateDOMSelection())}b.isIE&&(w=d.ownerDocument.defaultView||d.ownerDocument.parentWindow,c=w.screen.logicalXDPI/w.screen.deviceXDPI,w=w.screen.logicalYDPI/w.screen.deviceYDPI,m.left*=c,m.right*=c,m.top*=w,m.bottom*=w);return!1}n+=g;return!0})}f=this.getBoundingClientRect();
m||(e._wrapMode?(g=this.getClientRects(),m=g[g.length-1],m.left=m.right,m.left+=f.left,m.top+=f.top,m.right+=f.left,m.bottom+=f.top):(m=new u(f),m.left=m.right));if(c||void 0===c)m.left-=f.left,m.top-=f.top,m.right-=f.left,m.bottom-=f.top;return m},forEach:function(a){for(var b=this._ensureCreated().firstChild;b;){var c=b.nextSibling;if(!b.ignore&&!a.call(this,b))break;b=c}},_getClientRects:function(a,b){var c,d,e,f;if(!a._rectsCache){c=a.getClientRects();d=Array(c.length);for(f=0;f<c.length;f++)e=
d[f]=new u(c[f]),e.left-=b.left,e.top-=b.top,e.right-=b.left,e.bottom-=b.top;a._rectsCache=d}c=a._rectsCache;d=[c.length];for(f=0;f<c.length;f++)d[f]=new u(c[f]);return d},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var b=[],c=this._ensureCreated().getBoundingClientRect();this.forEach(function(a){a=this._getClientRects(a,c);for(var d=0;d<a.length;d++){var e=a[d],f,p;if(e.top!==e.bottom){var h=e.top+(e.bottom-e.top)/2;for(f=0;f<b.length&&!(p=b[f],p.top<=
h&&h<p.bottom);f++);f===b.length?b.push(e):(e.left<p.left&&(p.left=e.left),e.top<p.top&&(p.top=e.top),e.right>p.right&&(p.right=e.right),e.bottom>p.bottom&&(p.bottom=e.bottom))}}return!0});return void 0!==a?b[a]:b},_getLineBoundingClientRect:function(a,b){var c=new u(a.getBoundingClientRect());if(!this.view._wrapMode){c.right=c.left;for(var d=a.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;d&&(d=d.getBoundingClientRect(),c.right=d.right+s(a).right)}b&&(d=s(a),c.left+=d.left,
c.right-=d.right);return c},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var b=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var c=0;c<b.length;c++)if(b[c].top<=a&&a<b[c].bottom)return c;return b.length-1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var b=this.getClientRects();return this.getOffset(b[a].left+
1,b[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var b=a.firstChild.length;a.ignoreChars&&(b-=a.ignoreChars);return b},getModelOffset:function(a,b){if(!a)return 0;var c=0;this.forEach(function(d){var e=d.firstChild;if(e===a)return d.ignoreChars&&(c-=d.ignoreChars),c+=b,!1;d.ignoreChars&&(c-=d.ignoreChars);c+=e.data.length;return!0});return Math.max(0,c)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var b=0,c,d,e=this.view._model,f=e.getLineStart(this.lineIndex),
h=a-f,g=e.getLineEnd(this.lineIndex)-f;this.forEach(function(a){var e=a.firstChild,f=this._nodeLength(a);if(f+b>h||b+f>=g)return c=e,d=h-b,a.ignoreChars&&0<f&&d===f&&(d+=a.ignoreChars),!1;b+=f;return!0});return{node:c,offset:d}},getText:function(a){var b="",c=0;this.forEach(function(d){var e;if(d.ignoreChars){e=d.lastChild;for(var f=0,h=[],g=-1;e;){var m=e.data;if(m)for(var n=m.length-1;0<=n;n--){var q=m.substring(n,n+1);f<d.ignoreChars&&(" "===q||"\ufeff"===q)?f++:h.push("\u00a0"===q?"\t":q)}a===
e&&(g=h.length);e=e.previousSibling}h=h.reverse().join("");-1!==g&&(c=b.length+h.length-g);b+=h}else for(e=d.firstChild;e;)a===e&&(c=b.length),b+=e.data,e=e.nextSibling;return!0});return{text:b,offset:c}},getOffset:function(a,c){function d(e,r,n){var B=e.firstChild,s=l._nodeLength(e),t=q.ownerDocument,u=t.defaultView||t.parentWindow,A=b.isIE?u.screen.logicalXDPI/u.screen.deviceXDPI:1,y=b.isIE?u.screen.logicalYDPI/u.screen.deviceYDPI:1,v,x,z,u=n.left+k.left,C,E;if(b.isIE||f._isRangeRects){for(var t=
f._isRangeRects?t.createRange():t.body.createTextRange(),Q=s,K=-1;1<Q-K;){var T=Math.floor((Q+K)/2);n=K+1;v=T===s-1&&e.ignoreChars?B.length:T+1;C=0===n&&8===b.isIE;f._isRangeRects?(t.setStart(B,n),t.setEnd(B,v)):(C&&(n=1),t.moveToElementText(e),t.move("character",n),t.moveEnd("character",v-n));E=t.getClientRects();for(var S=!1,V=0;V<E.length;V++)if(n=E[V],v=(C?u:n.left)*A-k.left,z=n.right*A-k.left,x=n.top*y-k.top,n=n.bottom*y-k.top,v<=a&&a<z&&(!f._wrapMode||x<=c&&c<n)){S=!0;break}S?Q=T:K=T}r+=Q;n=
Q;v=Q===s-1&&e.ignoreChars?B.length:Math.min(Q+1,B.length);f._isRangeRects?(t.setStart(B,n),t.setEnd(B,v)):(t.moveToElementText(e),t.move("character",n),t.moveEnd("character",v-n));E=t.getClientRects();s=!1;0<E.length&&(n=E[0],v=(C?u:n.left)*A-k.left,z=n.right*A-k.left,s=a>v+(z-v)/2);e=r-m;B=h.getLine(g);A=B.charCodeAt(e);55296<=A&&56319>=A&&s?e<B.length&&(A=B.charCodeAt(e+1),56320<=A&&57343>=A&&(r+=1)):56320<=A&&57343>=A&&!s&&0<e&&(A=B.charCodeAt(e-1),55296<=A&&56319>=A&&(r-=1));s&&r++}else{A=[];
for(C=0;C<s;C++)A.push("\x3cspan\x3e"),C===s-1?A.push(B.data.substring(C)):A.push(B.data.substring(C,C+1)),A.push("\x3c/span\x3e");e.innerHTML=A.join("");for(A=e.firstChild;A;){n=A.getBoundingClientRect();v=n.left-k.left;z=n.right-k.left;if(v<=a&&a<z){a>v+(z-v)/2&&r++;break}r++;A=A.nextSibling}l._createdDiv||(e.innerHTML="",e.appendChild(B),e=f._getSelection(),(r<=e.start&&e.start<r+s||r<=e.end&&e.end<r+s)&&f._updateDOMSelection())}return r}function e(b){if(b.ignore)return null;b=l._getClientRects(b,
k);for(var d=0;d<b.length;d++){var r=b[d];if(r.left<=a&&a<r.right&&(!f._wrapMode||r.top<=c&&c<r.bottom))return r}return null}var f=this.view,h=f._model,g=this.lineIndex,m=h.getLineStart(g),n=h.getLineEnd(g);if(m===n)return m;var q=this._ensureCreated(),k=this.getBoundingClientRect(),l=this,s,t;if(f._wrapMode){s=this.getClientRects();c<s[0].top&&(c=s[0].top);for(var u=0;u<s.length&&!(t=s[u],t.top<=c&&c<t.bottom);u++);a<t.left&&(a=t.left);a>t.right&&(a=t.right-1)}else 0>a&&(a=0),a>k.right-k.left&&(a=
k.right-k.left);var A,y;if(this._lastHitChild&&this._lastHitChild.parentNode){if(A=this._lastHitOffset,y=this._lastHitChild,t=e(y),!t){s=A;for(var u=A+this._nodeLength(y),v=y.previousSibling,x=y.nextSibling;v||x;){if(v){s-=this._nodeLength(v);if(t=e(v)){y=v;A=s;break}v=v.previousSibling}if(x){if(t=e(x)){y=x;A=u;break}u+=this._nodeLength(x);x=x.nextSibling}}}}else A=m,this.forEach(function(a){y=a;if(t=e(y))return!1;A+=this._nodeLength(y);return!0});y&&t&&(this._lastHitChild=y,this._lastHitOffset=A,
A=d(y,A,t));return Math.min(n,Math.max(m,A))},getNextOffset:function(a,c){if("line"===c.unit){var d=this.view._model,e=d.getLineAtOffset(a);if(0<c.count)return c.count--,d.getLineEnd(e);c.count++;return d.getLineStart(e)}return"wordend"===c.unit||"wordWS"===c.unit||"wordendWS"===c.unit?this._getNextOffset_W3C(a,c):b.isIE?this._getNextOffset_IE(a,c):this._getNextOffset_W3C(a,c)},_getNextOffset_W3C:function(a,b){function c(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function d(a){return 32===
a||9===a}var e=this.view._model,f=e.getLineAtOffset(a),h=e.getLine(f),g=e.getLineStart(f),e=e.getLineEnd(f),f=h.length,m=a-g,n,q=0>b.count?-1:1;if("word"===b.unit||"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit)for(var k,l,s;0!==b.count;){if(0<b.count){if(m===f)return e;n=h.charCodeAt(m);k=c(n);l=!k&&!d(n);for(m++;m<f;){n=h.charCodeAt(m);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){s=c(n);if("wordend"===b.unit){if(!s&&k)break}else if(s&&!k)break;n=!s&&!d(n)}else n=!d(n);if("wordend"===
b.unit||"wordendWS"===b.unit){if(!n&&l)break}else if(n&&!l)break;l=n;k=s;m++}}else{if(0===m)return g;m--;n=h.charCodeAt(m);k=c(n);for(l=!k&&!d(n);0<m;){n=h.charCodeAt(m-1);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){s=c(n);if("wordend"===b.unit){if(s&&!k)break}else if(!s&&k)break;n=!s&&!d(n)}else n=!d(n);if("wordend"===b.unit||"wordendWS"===b.unit){if(n&&!l)break}else if(!n&&l)break;l=n;k=s;m--}}b.count-=q}else for(;0!==b.count&&0<=m+q&&m+q<=f;)m+=q,n=h.charCodeAt(m),56320<=n&&57343>=n&&0<m&&(n=h.charCodeAt(m-
1),55296<=n&&56319>=n&&(m+=q)),b.count-=q;return g+m},_getNextOffset_IE:function(a,b){var c=this._ensureCreated(),d=this.view._model,e=this.lineIndex,f=0,h;h=d.getLineStart(e);var g=c.ownerDocument,m=0>b.count?-1:1;if(a===d.getLineEnd(e)){for(c=c.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;if(!c)return h;f=g.body.createTextRange();f.moveToElementText(c);h=f.text.length;f.moveEnd(b.unit,m);f=a+f.text.length-h}else if(a===h&&0>b.count)f=h;else for(c=c.firstChild;c;){d=this._nodeLength(c);
if(h+d>a){f=g.body.createTextRange();if(a===h&&0>b.count){for(h=c.previousSibling;h&&(!h.firstChild||!h.firstChild.length);)h=h.previousSibling;f.moveToElementText(h?h:c.previousSibling)}else f.moveToElementText(c),f.collapse(),f.moveEnd("character",a-h);h=f.text.length;f.moveEnd(b.unit,m);f=a+f.text.length-h;break}h=d+h;c=c.nextSibling}b.count-=m;return f},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var b=this;this.forEach(function(c){var d=c.viewStyle;d&&d.tagName&&"a"===
d.tagName.toLowerCase()&&a.replaceChild(b._createSpan(a,c.firstChild.data,d),c);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};x.prototype={addKeyMode:function(a,b){var c=this._keyModes;void 0!==b?c.splice(b,0,a):c.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var c=this._rulers;if(void 0!==b){var d,e;for(e=d=0;d<c.length&&e<b;d++)a.getLocation()===c[d].getLocation()&&e++;c.splice(e,0,a);b=e}else c.push(a);
this._createRuler(a,b);this._update()},computeSize:function(){var a=0,c=0,d=this._model,e=this._clientDiv;if(!e)return{width:a,height:c};var f=e.style.width;b.isWebkit&&(e.style.width="0x7fffffffpx");for(var d=d.getLineCount(),h=0;h<d;h++){var g=this._getLine(h),m=g.getBoundingClientRect(),a=Math.max(a,m.right-m.left),c=c+(m.bottom-m.top);g.destroy()}b.isWebkit&&(e.style.width=f);e=this._getViewPadding();a+=e.right+e.left+this._metrics.scrollWidth;c+=e.bottom+e.top+this._metrics.scrollWidth;return{width:a,
height:c}},convert:function(a,b,c){if(this._clientDiv){var d=this._getScroll(),e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();"document"===b&&(void 0!==a.x&&(a.x+=-d.x+f.left+e.left),void 0!==a.y&&(a.y+=-d.y+f.top+e.top));"document"===c&&(void 0!==a.x&&(a.x+=d.x-f.left-e.left),void 0!==a.y&&(a.y+=d.y-f.top-e.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});
this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],c=this._actions,d;for(d in c)c.hasOwnProperty(d)&&(a||
!c[d].defaultHandler)&&b.push(d);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},getCaretOffset:function(){return this._getSelection().getCaret()},getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?
0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],c=this._keyModes,d=0;d<c.length;d++)b=b.concat(c[d].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model;
a=Math.min(Math.max(0,a),b.getCharCount());var b=b.getLineAtOffset(a),c=this._getLine(b);a=c.getBoundingClientRect(a);c.destroy();c=a.left;b=this._getLinePixel(b)+a.top;return{x:c,y:b}},getNextOffset:function(a,b){var c=new y(a,a,!1);this._doMove(b,c);return c.getCaret()},getOptions:function(){var a;if(0===arguments.length)a=this._defaultOptions();else if(1===arguments.length){if(a=arguments[0],"string"===typeof a)return c(this["_"+a])}else{a={};for(var b in arguments)arguments.hasOwnProperty(b)&&
(a[arguments[b]]=void 0)}for(var d in a)a.hasOwnProperty(d)&&(a[d]=c(this["_"+d]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var c=this._getLineIndex(b),d=this._getLine(c),c=d.getOffset(a,b-this._getLinePixel(c));d.destroy();return c},getLineAtOffset:function(a){this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=
this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,b,c){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(c))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(c)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},
onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},
onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},
onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},redraw:function(){if(!(0<this._redrawCount)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(0<this._redrawCount))for(var c=this.getRulers(),d=0;d<c.length;d++)this.redrawLines(a,b,c[d])},
redrawLines:function(a,b,c){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===b&&(b=this._model.getLineCount()),a!==b)){var d=this._clientDiv;if(d){if(c)for(d=this._getRulerParent(c).firstChild;d&&d._ruler!==c;)d=d.nextSibling;c?d.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,b);if(!c||"page"===c.getOverview())for(d=d.firstChild;d;){var e=d.lineIndex;a<=e&&e<b&&(d.lineChanged=!0);d=d.nextSibling}!c&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b&&(this._checkMaxLineIndex=
this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,b){if(!(0<this._redrawCount)){var c=this._model;void 0===a&&(a=0);void 0===b&&(b=c.getCharCount());var d=c.getLineAtOffset(a),c=c.getLineAtOffset(Math.max(a,b-1))+1;this.redrawLines(d,c)}},removeKeyMode:function(a){for(var b=this._keyModes,c=0;c<b.length;c++)if(b[c]===a){b.splice(c,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,c=0;c<b.length;c++)if(b[c]===
a){b.splice(c,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,c){if(a){var d=this._actions,e=d[a];e||(e=d[a]={});e.handler=b;void 0!==c&&(e.actionDescription=c)}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,c){var d=this._model.getCharCount();a=Math.max(0,Math.min(a,d));a=new y(a,a,!1);this._setSelection(a,void 0===b||b,!0,c)},setHorizontalPixel:function(a){this._clientDiv&&
(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?0===--this._redrawCount&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),c=this._model.getCharCount(),d=a.getLineCount(),e=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:c,
addedCharCount:e,removedLineCount:b,addedLineCount:d};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:e,removedLineCount:b,addedLineCount:d};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(b){var d=this._defaultOptions(),e;for(e in b)if(b.hasOwnProperty(e)){var f=b[e];if(!a(this["_"+
e],f)){var h=d[e]?d[e].update:null;h?h.call(this,f):this["_"+e]=c(f)}}},setSelection:function(a,b,c,d){var e=a>b;if(e){var f=a;a=b;b=f}f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));b=Math.max(0,Math.min(b,f));a=new y(a,b,e);this._setSelection(a,void 0===c||c,!0,d)},setText:function(a,c,d){var e=void 0===c&&void 0===d;void 0===c&&(c=0);void 0===d&&(d=this._model.getCharCount());e&&(this._variableLineHeight=!1);this._modifyContent({text:a,start:c,end:d,_code:!0},!e);e&&(this._columnX=-1,
this._setSelection(new y(0,0,!1),!0),13>b.isFirefox&&this._fixCaret())},setTopIndex:function(a){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,a)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(a,b){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===b||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)){13>b.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var c=this._overlayDiv||this._clientDiv;9>b.isIE&&(c=this._viewDiv);for(var d=a.target?a.target:a.srcElement;d;){if(c===d)return;d=d.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){!this._ignoreEvent(a)&&
13>b.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1)},_handleBlur:function(a){this._cancelCheckSelection();if(!this._ignoreBlur){this._hasFocus=!1;if(9>b.isIE&&!this._getSelection().isEmpty()){a=this._rootDiv;var c=b.createElement(a.ownerDocument,"div");a.appendChild(c);a.removeChild(c)}this._cursorDiv&&(this._cursorDiv.style.display="none");if(this._selDiv1)if(this._selDiv1.style.background="lightgray",
this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),c=this._selDiv1.ownerDocument,a.getSelection){c=a.getSelection();for(a=c.anchorNode;a;){if(a===this._clientDiv){0<c.rangeCount&&c.removeAllRanges();break}a=a.parentNode}}else if(c.selection){this._ignoreSelect=!1;for(a=c.selection.createRange().parentElement();a;){if(a===this._clientDiv){c.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},
_handleContextMenu:function(a){if(!this._ignoreEvent(a)){b.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var c=!1;this.isListening("ContextMenu")?(c=this._createMouseEvent("ContextMenu",a),c.screenX=a.screenX,c.screenY=a.screenY,this.onContextMenu(c),c=c.defaultPrevented):b.isMac&&b.isFirefox&&0===a.button&&(c=!0);if(c)return a.preventDefault&&a.preventDefault(),!1;this._contextMenuOpen=!0;b.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))}},_handleCopy:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){this._ignoreEvent(a)||(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),2!==this._clickCount&&(this._clickCount=2,this._handleMouse(a)))},
_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(13>b.isFirefox){var c=this;this._getWindow().setTimeout(function(){c._clientDiv.contentEditable=!0;c._clientDiv.draggable=!1;c._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&a.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",
a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));13>b.isFirefox&&(this._fixCaret(),"none"===a.dataTransfer.dropEffect&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var c=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(c=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(b.isWebkit||c)return a.preventDefault&&
a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var c=!0;this.isListening("DragOver")&&(c=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(b.isWebkit||c)return c&&(a.dataTransfer.dropEffect="none"),a.preventDefault&&a.preventDefault(),!1}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=
!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(a){this._hasFocus=!0;b.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display="block");this._selDiv1&&(a=this._highlightRGB,this._selDiv1.style.background=a,this._selDiv2.style.background=a,this._selDiv3.style.background=
a);if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var c=this._createKeyEvent("KeyDown",a);this.onKeyDown(c);if(c.defaultPrevented){b.isFirefox&&(this._keyDownPrevented=!0);a.preventDefault();return}}c=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:c=!0;break;default:this._setLinksVisible(!1)}if(229===a.keyCode){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;
c=!0;b.isSafari&&b.isMac&&a.ctrlKey&&(c=!1,a.keyCode=129);c&&this._startIME()}else c||this._commitIME();if((b.isMac||b.isLinux)&&4>b.isFirefox||12.16>b.isOpera)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1}},_handleKeyPress:function(a){if(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=void 0;else{if(b.isMac&&
b.isWebkit&&(63232<=a.keyCode&&63487>=a.keyCode||13===a.keyCode||8===a.keyCode)||((b.isMac||b.isLinux)&&4>b.isFirefox||12.16>b.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var c=b.isMac?a.metaKey:a.ctrlKey;if(void 0!==a.charCode&&c)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(c=this._createKeyEvent("KeyPress",a),this.onKeyPress(c),c.defaultPrevented))a.preventDefault();else{if(this._doAction(a))return a.preventDefault?
(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;c=!1;if(b.isMac){if(a.ctrlKey||a.metaKey)c=!0}else if(b.isFirefox){if(a.ctrlKey||a.altKey)c=!0}else a.ctrlKey^a.altKey&&(c=!0);if(!c&&(c=b.isOpera?a.which:void 0!==a.charCode?a.charCode:a.keyCode,31<c))return this._doContent(String.fromCharCode(c)),a.preventDefault&&a.preventDefault(),!1}}},_handleDocKeyUp:function(a){(b.isMac?a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=
this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(a){if(!(b.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var c=this._getWindow(),d=!0,e=c;if(b.isIE||b.isFirefox&&!this._overlayDiv)e=this._clientDiv;if(this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var f=this;c.setTimeout(function(){f.focus();f._ignoreFocus=
!1},0)}1===this._clickCount?(d=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!b.isOpera||12.16<=b.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if("A"!==(a.target||a.srcElement).tagName)this._setLinksVisible(!1);
else return;this._commitIME();var c=a.which;c||(4===a.button&&(c=2),2===a.button&&(c=3),1===a.button&&(c=1));var d=2!==c&&a.timeStamp?a.timeStamp:(new Date).getTime(),e=d-this._lastMouseTime,f=Math.abs(this._lastMouseX-a.clientX),h=Math.abs(this._lastMouseY-a.clientY),g=this._lastMouseButton===c;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=d;this._lastMouseButton=c;1===c&&(this._isMouseDown=!0,g&&e<=this._clickTime&&f<=this._clickDist&&h<=this._clickDist?this._clickCount++:
this._clickCount=1);if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",a),this.onMouseDown(d),d.defaultPrevented))a.preventDefault();else{if(1===c&&this._handleMouse(a)&&(9<=b.isIE||b.isOpera||b.isChrome||b.isSafari||b.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();b.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",
a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var c=this._isClientDiv(a);if(this.isListening("MouseMove")&&c)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var d=this._linksVisible||this._lastMouseMoveX!==a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;
this._setLinksVisible(d&&!this._isMouseDown&&(b.isMac?a.metaKey:a.ctrlKey));if(!this._isW3CEvents){if(0===a.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===a.button&&0!==(this._clickCount&1)&&c)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){c=a.clientX;a=a.clientY;var e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),h=this._getClientWidth(),g=this._getClientHeight(),d=f.left+e.left,m=f.top+e.top,h=f.left+
e.left+h,e=f.top+e.top+g;a<m?this._doAutoScroll("up",c,a-m):a>e?this._doAutoScroll("down",c,a-e):c<d&&!this._wrapMode?this._doAutoScroll("left",c-d,a):c>h&&!this._wrapMode?this._doAutoScroll("right",c-h,a):(this._endAutoScroll(),this._setSelectionTo(c,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=
!0}}},_createMouseEvent:function(a,b){var c=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var c=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||c&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",a));if(!this._linksVisible){if(c&&this._isMouseDown){if(-1!==this._dragOffset){var d=this._getSelection();
d.extend(this._dragOffset);d.collapse();this._setSelection(d,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}c&&b.isFirefox&&(this._updateDOMSelection(),a.preventDefault())}},_handleMouseWheel:function(a){var c=this._getLineHeight(),d=0,e=0;b.isIE||b.isOpera?e=-a.wheelDelta/40*c:b.isFirefox?"wheel"===a.type?a.deltaMode?(d=Math.max(-256,Math.min(256,a.deltaX))*c,e=Math.max(-256,Math.min(256,a.deltaY))*c):(d=a.deltaX,e=a.deltaY):(c=b.isMac?
3*a.detail:Math.max(-256,Math.min(256,a.detail))*c,a.axis===a.HORIZONTAL_AXIS?d=c:e=c):b.isMac?(e=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,d=0!==a.wheelDeltaX%120?1:40>e?40/(40-e):40,e=0!==a.wheelDeltaY%120?1:40>e?40/(40-e):40,d=Math.ceil(-a.wheelDeltaX/d),-1<d&&0>d&&(d=-1),0<d&&1>d&&(d=1),e=Math.ceil(-a.wheelDeltaY/e),-1<e&&0>e&&(e=-1),0<e&&1>e&&(e=1)):(d=-a.wheelDeltaX,e=8*(-a.wheelDeltaY/120)*c);if(b.isSafari||b.isChrome&&b.isMac){for(c=a.target;c&&void 0===c.lineIndex;)c=
c.parentNode;this._mouseWheelLine=c}c=this._getScroll();this._scrollView(d,e);d=this._getScroll();if(c.x!==d.x||c.y!==d.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(b.isIE){var c=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){c._updateDOMSelection();c._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(c){c=this._rootDiv.clientWidth;
var d=this._rootDiv.clientHeight;if(this._rootWidth!==c||this._rootHeight!==d)this._rootWidth!==c&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=c,this._rootHeight=d,c=9>b.isIE,d=this._calculateMetrics(),a(d,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=d,c=!0),c?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,c=b.lineIndex;b&&!b._ruler;)void 0===c&&void 0!==b.lineIndex&&
(c=b.lineIndex),b=b.parentNode;var d=b?b._ruler:null;if(void 0===c&&d&&"document"===d.getOverview()){var c=this._getClientHeight(),e=this._model.getLineCount(),f=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect(),c=Math.floor((a.clientY-h.top-this._metrics.scrollWidth)*e/(c+f.top+f.bottom-2*this._metrics.scrollWidth));0<=c&&c<e||(c=void 0)}if(d)switch(a.type){case "click":if(d.onClick)d.onClick(c,a);break;case "dblclick":if(d.onDblClick)d.onDblClick(c,a);break;case "mousemove":if(d.onMouseMove)d.onMouseMove(c,
a);break;case "mouseover":if(d.onMouseOver)d.onMouseOver(c,a);break;case "mouseout":if(d.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===b)return;e=e.parentNode}d.onMouseOut(c,a)}}},_handleScroll:function(){var a=this._getScroll(!1),b=this._hScroll,c=this._vScroll;if(b!==a.x||c!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(c===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:c},newValue:a})},_handleSelectStart:function(a){var b=this._contextMenuOpen;this._contextMenuOpen=
!1;if(b)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var c;c="DIV"===a.tagName?a:a.parentNode.parentNode;return!c._line?0:c._line.getModelOffset(a,b)}},_updateSelectionFromDOM:function(){if(!b.isOS&&!b.isAndroid&&!this._checkSelectionChange)return!1;var a=this._getWindow().getSelection(),c=this._getModelOffset(a.anchorNode,a.anchorOffset),d=this._getModelOffset(a.focusNode,a.focusOffset),e=this._getSelection();
if(void 0===c||void 0===d||e.start===c&&e.end===d)return!1;if(this._checkSelectionChange){var e=this._getLineNext(),f=this._getLinePrevious();if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.firstChild.firstChild&&0===a.focusOffset)return!1;if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.lastChild.firstChild||a.anchorNode===this._clientDiv&&a.focusNode===this._clientDiv)c=0,d=this.getModel().getCharCount()}this._setSelection(new y(c,d),
!1,!1);this._checkSelectionChange=!1;return!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){this._selPollTimer&&(this._getWindow().clearTimeout(this._selPollTimer),this._selPollTimer=null)},_pollSelectionChange:function(a){var b=this,c=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=c.setTimeout(function(){b._selPollTimer=null;b._clientDiv&&!b._updateSelectionFromDOM()&&
a&&b._pollSelectionChange(a)},100)},_handleSelectionChange:function(a){-1===this._imeOffset&&(b.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var c=b.anchorNode;c&&void 0===c.lineIndex;)c=c.parentNode;if(c){var d=this._model,
e=c.lineIndex,f=d.getLine(e),h=f,g=0,d=d.getLineStart(e);0<b.rangeCount&&(b.getRangeAt(0).deleteContents(),e=c.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(e),g=this._getDOMText(c,e),h=g.text,g=g.offset,e.parentNode.removeChild(e));c.lineRemoved=!0;for(c=0;f.charCodeAt(c)===h.charCodeAt(c)&&c<g;)c++;b=f.length-1;for(e=h.length-f.length;f.charCodeAt(b)===h.charCodeAt(b+e)&&b+e>=g+a.data.length;)b--;b++;f=h.substring(c,b+e);this._modifyContent({text:f,start:c+d,end:b+d,_ignoreDOMSelection:!0},
!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var c=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",c.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null);var d=a.touches;if(1===d.length){var d=d[0],e=d.clientX,f=d.clientY;this._touchStartX=e;this._touchStartY=f;if(b.isAndroid&&(f<d.pageY-c.pageYOffset||e<d.pageX-c.pageXOffset))e=d.pageX-c.pageXOffset,f=d.pageY-
c.pageYOffset;c=this.convert({x:e,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(c.x,c.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(1===b.length){b=b[0];this._touchCurrentX=b.clientX;this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var c=this,d=this._getWindow();this._touchScrollTimer=
d.setInterval(function(){var a=0,b=0;if(c._touching)a=c._touchStartX-c._touchCurrentX,b=c._touchStartY-c._touchCurrentY,c._touchSpeedX=a/10,c._touchSpeedY=b/10,c._touchStartX=c._touchCurrentX,c._touchStartY=c._touchCurrentY;else{if(0.1>Math.abs(c._touchSpeedX)&&0.1>Math.abs(c._touchSpeedY)){c._vScrollDiv.style.display="none";c._hScrollDiv.style.display="none";d.clearInterval(c._touchScrollTimer);c._touchScrollTimer=null;return}a=10*c._touchSpeedX;b=10*c._touchSpeedY;c._touchSpeedX*=0.95;c._touchSpeedY*=
0.95}c._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,c,d=this._keyModes;for(c=d.length-1;0<=c;c--)if(b=d[c],"function"===typeof b.match&&(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var c=this._model,d=b.getCaret(),e=c.getLineAtOffset(d);for(a.count||(a.count=1);0!==a.count;){var f=c.getLineStart(e);if(0>a.count&&d===f)if(0<e)"character"===
a.unit&&a.count++,e--,b.extend(c.getLineEnd(e));else break;else if(0<a.count&&d===c.getLineEnd(e))if(e+1<c.getLineCount())"character"===a.unit&&a.count--,e++,b.extend(c.getLineStart(e));else break;else{var h=!1;a.expandTab&&"character"===a.unit&&0===(d-f)%this._tabSize&&(f=c.getText(f,d),h=!/[^ ]/.test(f));h?(b.extend(d-this._tabSize),a.count+=0>a.count?1:-1):(f=this._getLine(e),b.extend(f.getNextOffset(d,a)),f.destroy())}d=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();
b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var c=this.getText(b.start,b.end);this._setSelection(b,!0);switch(a.type){case "lower":c=c.toLowerCase();break;case "capitalize":c=c.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<c.length;b++){var d=c[b],e=d.toLowerCase(),d=e!==
d?e:d.toUpperCase();a+=d}c=a;break;default:c=c.toUpperCase()}this._doContent(c);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var c=this._model,d=c.getLineAtOffset(b.end);b.end<c.getLineEnd(d)&&(c=this._getLine(d),b.extend(c.getNextOffset(b.getCaret(),{unit:"character",count:1})),c.destroy())}this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._setClipboardText(b,a)):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.end=b.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,b));a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),c=this._model,d;if(a.ctrl)b.extend(c.getCharCount()),d=function(){};else{var e=b.getCaret(),f=c.getLineAtOffset(e);if(this._wrapMode){var h=this._getLine(f),e=h.getLineIndex(e),e=e===h.getLineCount()-1?c.getLineEnd(f):h.getLineStart(e+1)-1;h.destroy()}else a.count&&
0<a.count&&(f=Math.min(f+a.count-1,c.getLineCount()-1)),e=c.getLineEnd(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,d);return!0},_doEnter:function(a){var b=this._model,c=this._getSelection();this._doContent(b.getLineDelimiter());a&&a.noCursor&&(c.end=c.start,this._setSelection(c,!0));return!0},_doHome:function(a){var b=this._getSelection(),c=this._model,d;if(a.ctrl)b.extend(0),d=function(){};else{var e=b.getCaret(),f=c.getLineAtOffset(e);this._wrapMode?(c=this._getLine(f),e=c.getLineIndex(e),
e=c.getLineStart(e),c.destroy()):e=c.getLineStart(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,d);return!0},_doLineDown:function(a){var c=this._model,d=this._getSelection(),e=d.getCaret(),f=c.getLineAtOffset(e),h=this._getLine(f),g=this._columnX,m=1,n=!1;if(-1===g||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?c.getLineEnd(f+1):e,g=h.getBoundingClientRect(g).left;(e=h.getLineIndex(e))<h.getLineCount()-1?m=h.getClientRects(e+1).top+1:(e=c.getLineCount()-1,n=f===e,a.count&&0<a.count?
f=Math.min(f+a.count,e):f++);e=!1;if(n){if(a.select||b.isMac||b.isLinux)d.extend(c.getCharCount()),e=!0}else h.lineIndex!==f&&(h.destroy(),h=this._getLine(f)),d.extend(h.getOffset(g,m)),e=!0;e&&(a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=g;h.destroy();return!0},_doLineUp:function(a){var c=this._model,d=this._getSelection(),e=d.getCaret(),f=c.getLineAtOffset(e),h=this._getLine(f),g=this._columnX,m=!1,n;if(-1===g||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?c.getLineStart(f-1):
e,g=h.getBoundingClientRect(g).left;0<(e=h.getLineIndex(e))?n=h.getClientRects(e-1).top+1:(m=0===f,m||(a.count&&0<a.count?f=Math.max(f-a.count,0):f--,n=this._getLineHeight(f)-1));e=!1;if(m){if(a.select||b.isMac||b.isLinux)d.extend(0),e=!0}else h.lineIndex!==f&&(h.destroy(),h=this._getLine(f)),d.extend(h.getOffset(g,n)),e=!0;e&&(a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=g;h.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var c=this,d=this._model,e=this._getSelection(),
f=e.getCaret(),h=d.getLineAtOffset(f),g=d.getLineCount(),m=this._getScroll(),d=this._getClientHeight(),n,q;if(this._lineHeight){n=this._columnX;m=this._getBoundsAtOffset(f);if(-1===n||a.select&&b.isIE)n=m.left;f=this._getLineIndex(m.top+d);q=this._getLine(f);h=this._getLinePixel(f);f=q.getOffset(n,m.top+d-h);d=q.getBoundingClientRect(f);q.destroy();e.extend(f);a.select||e.collapse();this._setSelection(e,!0,!0,function(){c._columnX=n},d.top+h-m.top);return!0}if(h<g-1){var k=this._getLineHeight(),l=
Math.min(g-h-1,Math.floor(d/k)),l=Math.max(1,l);n=this._columnX;if(-1===n||a.select&&b.isIE)q=this._getLine(h),n=q.getBoundingClientRect(f).left,q.destroy();q=this._getLine(h+l);e.extend(q.getOffset(n,0));q.destroy();a.select||e.collapse();a=g*k;f=m.y+l*k;f+d>a&&(f=a-d);this._setSelection(e,!0,!0,function(){c._columnX=n},f-m.y)}return!0},_doPageUp:function(a){var c=this,d=this._model,e=this._getSelection(),f=e.getCaret(),h=d.getLineAtOffset(f),g=this._getScroll(),m=this._getClientHeight(),n;if(this._lineHeight){n=
this._columnX;g=this._getBoundsAtOffset(f);if(-1===n||a.select&&b.isIE)n=g.left;f=this._getLineIndex(g.bottom-m);d=this._getLine(f);h=this._getLinePixel(f);f=d.getOffset(n,g.bottom-m-h);m=d.getBoundingClientRect(f);d.destroy();e.extend(f);a.select||e.collapse();this._setSelection(e,!0,!0,function(){c._columnX=n},m.top+h-g.top);return!0}if(0<h){var q=this._getLineHeight(),m=Math.max(1,Math.min(h,Math.floor(m/q)));n=this._columnX;if(-1===n||a.select&&b.isIE)d=this._getLine(h),n=d.getBoundingClientRect(f).left,
d.destroy();d=this._getLine(h-m);e.extend(d.getOffset(n,this._getLineHeight(h-m)-1));d.destroy();a.select||e.collapse();a=Math.max(0,g.y-m*q);this._setSelection(e,!0,!0,function(){c._columnX=n},a-g.y)}return!0},_doPaste:function(a){var c=this;return null!==this._getClipboardText(a,function(a){a&&(b.isLinux&&2===c._lastMouseButton&&(new Date).getTime()-c._lastMouseTime<=c._clickTime&&c._setSelectionTo(c._lastMouseX,c._lastMouseY),c._doContent(a))})},_doScroll:function(a){var b=a.type,c=this._model,
d=c.getLineCount();a=this._getClientHeight();var e=this._getLineHeight(),d=d*e,f=this._getScroll().y,h;switch(b){case "textStart":h=0;break;case "textEnd":h=d-a;break;case "pageDown":h=f+a;break;case "pageUp":h=f-a;break;case "lineDown":h=f+e;break;case "lineUp":h=f-e;break;case "centerLine":b=this._getSelection(),h=c.getLineAtOffset(b.start),c=(c.getLineAtOffset(b.end)-h+1)*e,h=h*e-a/2+c/2}void 0!==h&&(h=Math.min(Math.max(0,h),d-a),this._scrollViewAnimated(0,h-f,function(){}));return!0},_doSelectAll:function(a){a=
this._model;var b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var b=this._model;a=this._getSelection().getCaret();var c=b.getLineAtOffset(a),b=b.getLineStart(c);a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ")}this._doContent(a);return!0}},_doShiftTab:function(a){if(this._tabMode&&!this._readonly)return!0},_doOverwriteMode:function(a){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),
!0},_doTabMode:function(a){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(a){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=this._model,c=this._getSelection(),d=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=c.getCaret(),f=a.getLineCount(),h=a.getLineAtOffset(e),g;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)e=this._autoScrollY/this._getLineHeight(),e=0>e?Math.floor(e):Math.ceil(e),g=Math.max(0,
Math.min(f-1,h+e));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)g=this._getLineIndex(d.y),h=this._getLine(h),d.x+=h.getBoundingClientRect(e,!1).left,h.destroy();0===g&&(b.isMac||b.isLinux)?c.extend(0):g===f-1&&(b.isMac||b.isLinux)?c.extend(a.getCharCount()):(h=this._getLine(g),c.extend(h.getOffset(d.x,d.y-this._getLinePixel(g))),h.destroy());this._setSelection(c,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},
this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),c=0;if(a){a=0;for(var d=(new Date).getTime(),e=0;c<b&&!(this._lineHeight[c]||(a++,e||(e=c),this._lineHeight[c]=this._calculateLineHeight(c)),c++,100<(new Date).getTime()-d););this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(c!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},
0)}else this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(a){a=this._getLine(a);var b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,c=a.ownerDocument,d=b.createElement(c,"div");d.style.lineHeight="normal";var e={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(e);f(e.style,d);d.style.position="fixed";
d.style.left="-1000px";var h=b.createElement(c,"span");h.appendChild(c.createTextNode(" "));d.appendChild(h);var g=b.createElement(c,"span");g.style.fontStyle="italic";g.appendChild(c.createTextNode(" "));d.appendChild(g);var m=b.createElement(c,"span");m.style.fontWeight="bold";m.appendChild(c.createTextNode(" "));d.appendChild(m);e=b.createElement(c,"span");e.style.fontWeight="bold";e.style.fontStyle="italic";e.appendChild(c.createTextNode(" "));d.appendChild(e);a.appendChild(d);var n=d.getBoundingClientRect(),
h=h.getBoundingClientRect(),g=g.getBoundingClientRect(),m=m.getBoundingClientRect(),e=e.getBoundingClientRect(),h=h.bottom-h.top,g=g.bottom-g.top,m=m.bottom-m.top,k=e.bottom-e.top,l=0,e=0>=n.bottom-n.top,n=Math.max(1,n.bottom-n.top);g>h&&(l=1);m>g&&(l=2);k>m&&(l=3);var t;0!==l&&(t={style:{}},0!==(l&1)&&(t.style.fontStyle="italic"),0!==(l&2)&&(t.style.fontWeight="bold"));h=s(d);a.removeChild(d);k=q(this._viewDiv);d=b.createElement(c,"div");d.style.position="fixed";d.style.left="-1000px";d.style.paddingLeft=
k.left+"px";d.style.paddingTop=k.top+"px";d.style.paddingRight=k.right+"px";d.style.paddingBottom=k.bottom+"px";d.style.width="100px";d.style.height="100px";k=b.createElement(c,"div");k.style.width="100%";k.style.height="100%";d.appendChild(k);a.appendChild(d);l=d.getBoundingClientRect();g=k.getBoundingClientRect();m=0;this._singleMode||(d.style.overflow="hidden",k.style.height="200px",m=d.clientWidth,d.style.overflow="scroll",m-=d.clientWidth);a.removeChild(d);k={left:g.left-l.left,top:g.top-l.top,
right:l.right-g.right,bottom:l.bottom-g.bottom};g=l=0;if(!e&&(this._wrapOffset||this._marginOffset))d=b.createElement(c,"div"),d.style.position="fixed",d.style.left="-1000px",d.innerHTML=Array(this._wrapOffset+1+(b.isWebkit?0:1)).join(" "),a.appendChild(d),l=d.getBoundingClientRect(),l=Math.ceil(l.right-l.left),d.innerHTML=Array(this._marginOffset+1).join(" "),g=d.getBoundingClientRect(),g=Math.ceil(g.right-g.left),a.removeChild(d);return{lineHeight:n,largestFontStyle:t,lineTrim:h,viewPadding:k,scrollWidth:m,
wrapWidth:l,marginWidth:g,invalid:e}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=this._getSelection();if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(-1!==this._imeOffset){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),c=a.getLineStart(b),d=this._getDOMText(this._getLineNode(b)).text,a=
a.getLine(b),c=this._imeOffset-c,a=c+d.length-a.length;c!==a&&(d=d.substring(c,a),this._doContent(d));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new k.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!1}))},actionDescription:{name:g.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(m(b,{select:!1}))},actionDescription:{name:g.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(m(b,
{select:!1,ctrl:!1}))},actionDescription:{name:g.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!1,ctrl:!1}))},actionDescription:{name:g.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!1,unit:"character"}))},actionDescription:{name:g.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(m(b,{select:!1,unit:"character"}))},actionDescription:{name:g.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(m(b,
{select:!1}))},actionDescription:{name:g.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(m(b,{select:!1}))},actionDescription:{name:g.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(m(b,{type:"pageUp"}))},actionDescription:{name:g.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(m(b,{type:"pageDown"}))},actionDescription:{name:g.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(m(b,{type:"lineUp"}))},
actionDescription:{name:g.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(m(b,{type:"lineDown"}))},actionDescription:{name:g.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!1,unit:"word"}))},actionDescription:{name:g.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(m(b,{select:!1,unit:"word"}))},actionDescription:{name:g.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!1,
ctrl:!0}))},actionDescription:{name:g.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!1,ctrl:!0}))},actionDescription:{name:g.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(m(b,{type:"textStart"}))},actionDescription:{name:g.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(m(b,{type:"textEnd"}))},actionDescription:{name:g.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(m(b,{type:"centerLine"}))},
actionDescription:{name:g.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!0}))},actionDescription:{name:g.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(m(b,{select:!0}))},actionDescription:{name:g.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!0,wholeLine:!0}))},actionDescription:{name:g.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(m(b,
{select:!0,wholeLine:!0}))},actionDescription:{name:g.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!0,ctrl:!1}))},actionDescription:{name:g.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!0,ctrl:!1}))},actionDescription:{name:g.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!0,unit:"character"}))},actionDescription:{name:g.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(m(b,
{select:!0,unit:"character"}))},actionDescription:{name:g.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(m(b,{select:!0}))},actionDescription:{name:g.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(m(b,{select:!0}))},actionDescription:{name:g.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!0,unit:"word"}))},actionDescription:{name:g.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(m(b,
{select:!0,unit:"word"}))},actionDescription:{name:g.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!0,ctrl:!0}))},actionDescription:{name:g.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!0,ctrl:!0}))},actionDescription:{name:g.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"character"}))},actionDescription:{name:g.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(m(b,
{unit:"character"}))},actionDescription:{name:g.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"word"}))},actionDescription:{name:g.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(m(b,{unit:"word"}))},actionDescription:{name:g.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"line"}))},actionDescription:{name:g.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(m(b,
{unit:"line"}))},actionDescription:{name:g.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab()},actionDescription:{name:g.tab}},shiftTab:{defaultHandler:function(b){return a._doShiftTab()},actionDescription:{name:g.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter()},actionDescription:{name:g.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(m(b,{noCursor:!0}))},actionDescription:{name:g.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll()},
actionDescription:{name:g.selectAll}},copy:{defaultHandler:function(b){return a._doCopy()},actionDescription:{name:g.copy}},cut:{defaultHandler:function(b){return a._doCut()},actionDescription:{name:g.cut}},paste:{defaultHandler:function(b){return a._doPaste()},actionDescription:{name:g.paste}},uppercase:{defaultHandler:function(b){return a._doCase(m(b,{type:"upper"}))},actionDescription:{name:g.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(m(b,{type:"lower"}))},actionDescription:{name:g.lowercase}},
capitalize:{defaultHandler:function(b){return a._doCase(m(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:g.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(m(b,{type:"reverse"}))},actionDescription:{name:g.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode()},actionDescription:{name:g.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode()},actionDescription:{name:g.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode()},
actionDescription:{name:g.toggleWrapMode}}}},_createRulerParent:function(a,c){var d=b.createElement(a,"div");d.className=c;d.tabIndex=-1;d.style.overflow="hidden";d.style.MozUserSelect="none";d.style.WebkitUserSelect="none";d.style.position="absolute";d.style.top="0px";d.style.bottom="0px";d.style.cursor="default";d.style.display="none";d.setAttribute("aria-hidden","true");this._rootDiv.appendChild(d);return d},_createRuler:function(a,c){if(this._clientDiv){var d=this._getRulerParent(a);if(d){if(d!==
this._marginDiv||this._marginOffset)d.style.display="block";var e=b.createElement(d.ownerDocument,"div");e._ruler=a;e.rulerChanged=!0;e.style.position="relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(void 0===c||0>c||c>=d.children.length)d.appendChild(e);else{for(var f=d.firstChild;f&&0<c--;)f=f.nextSibling;d.insertBefore(e,f)}}}},_createView:function(){function a(){h._rootDiv&&(h.update(!0),h._metrics.invalid&&h._getWindow().setTimeout(function(){a()},100))}
if(!this._clientDiv){for(var c=this._parent;c.hasChildNodes();)c.removeChild(c.lastChild);var d=c.ownerDocument,e=b.createElement(d,"div");this._rootDiv=e;e.tabIndex=-1;e.style.position="relative";e.style.overflow="hidden";e.style.width="100%";e.style.height="100%";e.style.overflow="hidden";e.style.WebkitTextSizeAdjust="100%";e.setAttribute("role","application");c.appendChild(e);this._leftDiv=this._createRulerParent(d,"textviewLeftRuler");c=b.createElement(d,"div");c.className="textviewScroll";this._viewDiv=
c;c.tabIndex=-1;c.style.position="absolute";c.style.top="0px";c.style.bottom="0px";c.style.borderWidth="0px";c.style.margin="0px";c.style.outline="none";c.style.background="transparent";b.isMac&&b.isWebkit&&(c.style.pointerEvents="none",c.style.zIndex="2");e.appendChild(c);var f=this._createRulerParent(d,"textviewRightRuler");this._rightDiv=f;f.style.right="0px";this._scrollDiv=f=b.createElement(d,"div");f.style.margin="0px";f.style.borderWidth="0px";f.style.padding="0px";c.appendChild(f);(this._marginDiv=
this._createRulerParent(d,"textviewMarginRuler")).style.zIndex="4";!b.isIE&&!b.isIOS&&(this._clipDiv=c=b.createElement(d,"div"),c.style.position="absolute",c.style.overflow="hidden",c.style.margin="0px",c.style.borderWidth="0px",c.style.padding="0px",c.style.background="transparent",e.appendChild(c),this._clipScrollDiv=f=b.createElement(d,"div"),f.style.position="absolute",f.style.height="1px",f.style.top="-1000px",f.style.background="transparent",c.appendChild(f));this._setFullSelection(this._fullSelection,
!0);c=b.createElement(d,"div");c.className="textviewContent";this._clientDiv=c;c.tabIndex=0;c.style.position="absolute";c.style.borderWidth="0px";c.style.margin="0px";c.style.padding="0px";c.style.outline="none";c.style.zIndex="1";c.style.WebkitUserSelect="text";c.setAttribute("spellcheck","false");if(b.isIOS||b.isAndroid)c.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(c);if(b.isIOS||b.isAndroid)this._vScrollDiv=f=b.createElement(d,"div"),f.style.position="absolute",f.style.borderWidth=
"1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.width="8px",f.style.display="none",e.appendChild(f),this._hScrollDiv=f=b.createElement(d,"div"),f.style.position="absolute",f.style.borderWidth="1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",
f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.height="8px",f.style.display="none",e.appendChild(f);b.isFirefox&&!c.setCapture&&(this._overlayDiv=f=b.createElement(d,"div"),f.style.position=c.style.position,f.style.borderWidth=c.style.borderWidth,f.style.margin=c.style.margin,f.style.padding=c.style.padding,f.style.cursor="text",f.style.zIndex="2",(this._clipDiv||e).appendChild(f));c.contentEditable="true";c.setAttribute("role","textbox");
c.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,!0);this._hookEvents();c=this._rulers;for(f=0;f<c.length;f++)this._createRuler(c[f]);this._update();var h=this;t(d,e,"textview",a)}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},
readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},wrapMode:{value:!1,update:this._setWrapMode},
wrappable:{value:!1,update:null},theme:{value:d.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var c=b.firstChild;c;){if(c._ruler===a){c._ruler=void 0;b.removeChild(c);if(0===b.children.length&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}c=c.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();
this._autoScrollTimerID&&(a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null);this._updateTimer&&(a.clearTimeout(this._updateTimer),this._updateTimer=null);a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,
b,c){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=c;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,b){var c=this._model;
c.getBaseModel&&(a=c.mapOffset(a),b=c.mapOffset(b),c=c.getBaseModel());return c.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var c=this._clientDiv.getBoundingClientRect();a.bottom>c.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var c=this._getLinePixel(b.lineIndex);a.top+=
c;a.bottom+=c;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,c){var d=this._model.getLineDelimiter(),e,f,h=this._getWindow(),g=h.clipboardData;!g&&a&&(g=a.clipboardData);if(g)return e=[],f=g.getData(b.isIE?"Text":"text/plain"),n(f,function(a){e.push(a)},function(){e.push(d)}),
f=e.join(""),c&&c(f),f;if(b.isFirefox){this._ignoreFocus=!0;var m=this._clipboardDiv,g=this._rootDiv.ownerDocument;m||(this._clipboardDiv=m=b.createElement(g,"div"),m.style.position="fixed",m.style.whiteSpace="pre",m.style.left="-1000px",this._rootDiv.appendChild(m));m.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";m.firstChild.focus();var q=this,k=function(){var a=q._getTextFromElement(m);m.innerHTML="";e=[];n(a,function(a){e.push(a)},function(){e.push(d)});return e.join("")},l=!1;this._ignorePaste=
!0;if(!b.isLinux||2!==this._lastMouseButton)try{l=g.execCommand("paste",!1,null)}catch(s){l=1<m.childNodes.length||m.firstChild&&0<m.firstChild.childNodes.length}this._ignorePaste=!1;if(!l){if(a)return h.setTimeout(function(){q.focus();(f=k())&&c&&c(f);q._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(f=k())&&c&&c(f);return f}return""},_getDOMText:function(a,b){return a._line.getText(b)},_getTextFromElement:function(a){var b=a.ownerDocument,c=
b.defaultView;if(!c.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);a=c.getSelection();var c=[],d;for(d=0;d<a.rangeCount;d++)c.push(a.getRangeAt(d));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(d=0;d<c.length;d++)a.addRange(c[d]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:
new v(this,a)},_getLineHeight:function(a,b){if(void 0!==a&&this._lineHeight){var c=this._lineHeight[a];if(c)return c;if(b||void 0===b)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var b=this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&-1===a.lineIndex;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:
this._clientDiv.lastChild;a&&-1===a.lineIndex;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),c=-this._topIndexY+this._getScroll().y;if(a>b)for(;b<a;b++)c+=this._getLineHeight(b);else for(b-=1;b>=a;b--)c-=this._getLineHeight(b);return c}return this._getLineHeight()*a},_getLineIndex:function(a){var b,c=0,d=this._model.getLineCount();if(this._lineHeight){var c=this._getTopIndex(),e=-this._topIndexY+
this._getScroll().y;if(a!==e)if(a<e)for(;a<e&&0<c;)a+=this._getLineHeight(--c);else for(b=this._getLineHeight(c);a-b>=e&&c<d-1;)a-=b,b=this._getLineHeight(++c)}else b=this._getLineHeight(),c=Math.floor(a/b);return Math.max(0,Math.min(d-1,c))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(void 0===a||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,
y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var c=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();a.top<d.top+c.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",
this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(b){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var c=this._handlers=[],d=this._clientDiv,e=this._viewDiv,f=this._rootDiv,h=this._overlayDiv||d,g=d.ownerDocument,m=this._getWindow(),n=b.isIE?g:m;c.push({target:m,type:"resize",handler:function(b){return a._handleResize(b?b:m.event)}});c.push({target:d,
type:"blur",handler:function(b){return a._handleBlur(b?b:m.event)}});c.push({target:d,type:"focus",handler:function(b){return a._handleFocus(b?b:m.event)}});c.push({target:e,type:"focus",handler:function(a){d.focus()}});c.push({target:e,type:"scroll",handler:function(b){return a._handleScroll(b?b:m.event)}});c.push({target:d,type:"textInput",handler:function(b){return a._handleTextInput(b?b:m.event)}});c.push({target:d,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:m.event)}});c.push({target:d,
type:"keypress",handler:function(b){return a._handleKeyPress(b?b:m.event)}});c.push({target:d,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:m.event)}});b.isIE&&c.push({target:g,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?b:m.event)}});c.push({target:d,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:m.event)}});c.push({target:d,type:"copy",handler:function(b){return a._handleCopy(b?b:m.event)}});c.push({target:d,type:"cut",handler:function(b){return a._handleCut(b?
b:m.event)}});c.push({target:d,type:"paste",handler:function(b){return a._handlePaste(b?b:m.event)}});c.push({target:g,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:m.event)}});if(b.isIOS||b.isAndroid)c.push({target:d,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:m.event)}}),c.push({target:d,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:m.event)}}),c.push({target:d,type:"touchend",handler:function(b){return a._handleTouchEnd(b?
b:m.event)}});else{c.push({target:d,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:m.event)}});c.push({target:d,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:m.event)}});c.push({target:d,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:m.event)}});c.push({target:d,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:m.event)}});c.push({target:n,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:m.event)}});c.push({target:n,
type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:m.event)}});c.push({target:f,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:m.event)}});c.push({target:f,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?b:m.event)}});c.push({target:h,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:m.event)}});c.push({target:h,type:"drag",handler:function(b){return a._handleDrag(b?b:m.event)}});c.push({target:h,type:"dragend",handler:function(b){return a._handleDragEnd(b?
b:m.event)}});c.push({target:h,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:m.event)}});c.push({target:h,type:"dragover",handler:function(b){return a._handleDragOver(b?b:m.event)}});c.push({target:h,type:"dragleave",handler:function(b){return a._handleDragLeave(b?b:m.event)}});c.push({target:h,type:"drop",handler:function(b){return a._handleDrop(b?b:m.event)}});c.push({target:this._clientDiv,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?
b:m.event)}});this._clipDiv&&c.push({target:this._clipDiv,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:m.event)}});if(b.isFirefox&&(!b.isWindows||15<=b.isFirefox))(e=m.MutationObserver||m.MozMutationObserver)?(this._mutationObserver=new e(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):c.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?
b:m.event)}});this._overlayDiv&&(c.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:m.event)}}),c.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:m.event)}}),c.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:m.event)}}),c.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:m.event)}}));this._isW3CEvents||c.push({target:this._clientDiv,
type:"dblclick",handler:function(b){return a._handleDblclick(b?b:m.event)}})}this._hookRulerEvents(this._leftDiv,c);this._hookRulerEvents(this._rightDiv,c);this._hookRulerEvents(this._marginDiv,c);for(e=0;e<c.length;e++)f=c[e],z(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(a,c){if(a){var d=this,e=this._getWindow();b.isIE&&c.push({target:a,type:"selectstart",handler:function(){return!1}});c.push({target:a,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return d._handleMouseWheel(a?
a:e.event)}});c.push({target:a,type:"click",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"dblclick",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"mousemove",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"mouseover",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"mouseout",handler:function(a){d._handleRulerEvent(a?a:e.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||
this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var c=a.parent;"string"===typeof c&&(c=(a.document||document).getElementById(c));if(!c)throw"no parent";a.parent=c;a.model=a.model||new l.TextModel;var d=this._defaultOptions(),e;for(e in d)d.hasOwnProperty(e)&&(this["_"+e]=void 0!==a[e]?a[e]:d[e].value);this._keyModes=[];this._rulers=[];this._selection=new y(0,0,!1);this._linksVisible=
!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=(!b.isIE||9<=b.isIE)&&"function"===typeof c.ownerDocument.createRange().getBoundingClientRect;this._isW3CEvents=c.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=
this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_modifyContent:function(a,b){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(null===a.text||void 0===a.text)){var c=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),c.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}b&&(c=
this._getSelection(),c.setCaret(a.start+a.text.length),this._setSelection(c,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var b=a.start,c=a.addedCharCount,d=a.removedCharCount,e=a.addedLineCount,f=a.removedLineCount,h=this._getSelection();h.end>b&&(h.end>b&&h.start<b+d?h.setCaret(b+c):(h.start+=c-d,h.end+=c-d),this._setSelection(h,!1,!1));b=this._model.getLineAtOffset(b);for(c=this._getLineNext();c;)d=c.lineIndex,b<=
d&&d<=b+f&&(b===d&&!c.modelChangedEvent&&!c.lineRemoved?(c.modelChangedEvent=a,c.lineChanged=!0):(c.lineRemoved=!0,c.lineChanged=!1,c.modelChangedEvent=null)),d>b+f&&(c.lineIndex=d+e-f,c._line.lineIndex=c.lineIndex),c=this._getLineNext(c);this._lineHeight&&(a=[b,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+f&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},
_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var c=a;c<b;c++)this._lineHeight[c]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=
null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new y(0,0,!1),!1,!1);this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>b.isFirefox&&
this._fixCaret()}},_scrollViewAnimated:function(a,b,c){var d=this._getWindow();if(c&&this._scrollAnimation){var e=this;this._animation=new C({window:d,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);c&&d.setTimeout(c,0)}});this._animation.play()}else this._scrollView(a,b),c&&d.setTimeout(c,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var c=this._viewDiv;a&&(c.scrollLeft+=
a);b&&(c.scrollTop+=b)},_setClipboardText:function(a,c){var d,e=this._getWindow(),f=e.clipboardData;!f&&c&&(f=c.clipboardData);if(f&&(d=[],n(a,function(a){d.push(a)},function(){d.push(b.platformDelimiter)}),f.setData(b.isIE?"Text":"text/plain",d.join(""))))return!0;var h=this._parent.ownerDocument,g=b.createElement(h,"pre");g.style.position="fixed";g.style.left="-1000px";n(a,function(a){g.appendChild(h.createTextNode(a))},function(){g.appendChild(b.createElement(h,"br"))});g.appendChild(h.createTextNode(" "));
this._clientDiv.appendChild(g);f=h.createRange();f.setStart(g.firstChild,0);f.setEndBefore(g.lastChild);var m=e.getSelection();0<m.rangeCount&&m.removeAllRanges();m.addRange(f);var q=this,f=function(){g&&g.parentNode===q._clientDiv&&q._clientDiv.removeChild(g);q._updateDOMSelection()},m=!1;this._ignoreCopy=!0;try{m=h.execCommand("copy",!1,null)}catch(k){}this._ignoreCopy=!1;if(!m&&c)return e.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(a,c,d,e,f){this._setDOMFullSelection(a,c,d,e);a=
a._line.getNodeOffset(c);d=d._line.getNodeOffset(e);e=this._getWindow();c=this._parent.ownerDocument;if(e.getSelection){var h=e.getSelection();e=c.createRange();e.setStart(a.node,a.offset);e.setEnd(d.node,d.offset);if(this._hasFocus&&(h.anchorNode!==a.node||h.anchorOffset!==a.offset||h.focusNode!==d.node||h.focusOffset!==d.offset||h.anchorNode!==d.node||h.anchorOffset!==d.offset||h.focusNode!==a.node||h.focusOffset!==a.offset))this._anchorNode=a.node,this._anchorOffset=a.offset,this._focusNode=d.node,
this._focusOffset=d.offset,this._ignoreSelect=!1,0<h.rangeCount&&h.removeAllRanges(),h.addRange(e),this._ignoreSelect=!0;this._cursorDiv&&(e=c.createRange(),f?(e.setStart(a.node,a.offset),e.setEnd(a.node,a.offset)):(e.setStart(d.node,d.offset),e.setEnd(d.node,d.offset)),f=e.getClientRects()[0],a=this._cursorDiv.parentNode,d=a.getBoundingClientRect(),f&&d&&(this._cursorDiv.style.top=f.top-d.top+a.scrollTop+"px",this._cursorDiv.style.left=f.left-d.left+a.scrollLeft+"px"))}else c.selection&&this._hasFocus&&
(f=c.body,e=b.createElement(c,"div"),f.appendChild(e),f.removeChild(e),e=f.createTextRange(),e.moveToElementText(a.node.parentNode),e.moveStart("character",a.offset),f=f.createTextRange(),f.moveToElementText(d.node.parentNode),f.moveStart("character",d.offset),e.setEndPoint("EndToStart",f),this._ignoreSelect=!1,e.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,b,c,d){if(this._selDiv1){var e=this._selDiv1;e.style.width="0px";e.style.height="0px";e=this._selDiv2;e.style.width="0px";
e.style.height="0px";e=this._selDiv3;e.style.width="0px";e.style.height="0px";if(!(a===c&&b===d)){var f=this._getViewPadding(),h=this._clientDiv.getBoundingClientRect(),g=this._viewDiv.getBoundingClientRect(),e=g.left+f.left,m=h.right,f=g.top+f.top,n=h.bottom,g=h=0;this._clipDiv?(g=this._clipDiv.getBoundingClientRect(),h=g.left-this._clipDiv.scrollLeft):(g=this._rootDiv.getBoundingClientRect(),h=g.left);g=g.top;this._ignoreDOMSelection=!0;var q=(new v(this,a.lineIndex,a)).getBoundingClientRect(b,
!1),k=q.left;b=(new v(this,c.lineIndex,c)).getBoundingClientRect(d,!1);var l=b.left;this._ignoreDOMSelection=!1;var s=this._selDiv1,k=Math.min(m,Math.max(e,k)),t=Math.min(n,Math.max(f,q.top)),A=m;d=Math.min(n,Math.max(f,q.bottom));s.style.left=k-h+"px";s.style.top=t-g+"px";s.style.width=Math.max(0,A-k)+"px";s.style.height=Math.max(0,d-t)+"px";a.lineIndex===c.lineIndex?(A=Math.min(l,m),s.style.width=Math.max(0,A-k)+"px"):(q=Math.min(n,Math.max(f,b.top)),l=Math.min(m,Math.max(e,l)),f=Math.min(n,Math.max(f,
b.bottom)),n=this._selDiv3,n.style.left=e-h+"px",n.style.top=q-g+"px",n.style.width=Math.max(0,l-e)+"px",n.style.height=Math.max(0,f-q)+"px",1<Math.abs(a.lineIndex-c.lineIndex)&&(a=this._selDiv2,a.style.left=e-h+"px",a.style.top=d-g+"px",a.style.width=Math.max(0,m-e)+"px",a.style.height=Math.max(0,q-d)+"px"))}}},_setGrab:function(a){a!==this._grabControl&&(a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null))},
_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;b.isIE&&a&&(this._hadFocus=this._hasFocus);var c=this._clientDiv;c.contentEditable=!a;this._hadFocus&&!a&&c.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=a?"-1":"1");for(a=this._getLineNext();a;)a._line.updateLinks(),a=this._getLineNext(a);this._updateDOMSelection()}},_setSelection:function(a,b,c,d,e){if(a){this._columnX=-1;void 0===c&&(c=!0);var f=this._selection;this._selection=a;!1!==b&&this._showCaret(!1,d,
b,e);c&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,c,d){var e=this._model,f=this._getSelection();b=this.convert({x:a,y:b},"page","document");a=this._getLineIndex(b.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(d&&!c&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);c||f.collapse()}else 0===
(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(c=this._doubleClickSelection.start,d=e.getNextOffset(a,{unit:"wordend",count:1})):(c=e.getNextOffset(a,{unit:"word",count:-1}),d=this._doubleClickSelection.end):(c=e.getNextOffset(a,{unit:"word",count:-1}),d=e.getNextOffset(c,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(d=e.getLineAtOffset(this._doubleClickSelection.start),a>=
d?(c=e.getLineStart(d),d=e.getLineEnd(a)):(c=e.getLineStart(a),d=e.getLineEnd(d))):(c=e.getLineStart(a),d=e.getLineEnd(a)),f.setCaret(c),f.extend(d);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,c){this._fullSelection=a;b.isWebkit&&(this._fullSelection=!0);var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!b.isIOS){var e=d.ownerDocument;this._highlightRGB=b.isWebkit?"transparent":"Highlight";var f=b.createElement(e,"div");
this._selDiv1=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex="0";d.appendChild(f);var h=b.createElement(e,"div");this._selDiv2=h;h.style.position="absolute";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.background=this._highlightRGB;h.style.width="0px";h.style.height="0px";h.style.zIndex=
"0";d.appendChild(h);this._selDiv3=e=b.createElement(e,"div");e.style.position="absolute";e.style.borderWidth="0px";e.style.margin="0px";e.style.padding="0px";e.style.outline="none";e.style.background=this._highlightRGB;e.style.width="0px";e.style.height="0px";e.style.zIndex="0";d.appendChild(e);if(b.isFirefox&&b.isMac){d=this._getWindow().getComputedStyle(e,null).getPropertyValue("background-color");switch(d){case "rgb(119, 141, 168)":d="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":d="rgb(198, 198, 198)";
break;case "rgb(255, 193, 31)":d="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":d="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":d="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":d="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":d="rgb(232, 184, 255)";break;default:d="rgb(180, 213, 255)"}this._highlightRGB=d;f.style.background=d;h.style.background=d;e.style.background=d}c||this._updateDOMSelection()}}else this._selDiv1&&(d.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&
(d.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(d.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,c=b.createElement(a.ownerDocument,"div");c.className="textviewBlockCursor";this._cursorDiv=
c;c.tabIndex=-1;c.style.zIndex="2";c.style.color="transparent";c.style.position="absolute";c.style.pointerEvents="none";c.innerHTML="\x26nbsp;";a.appendChild(c);this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,b){this._wrapOffset=
a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,c){this._tabSize=a;this._customTabSize=void 0;var d=this._clientDiv;b.isOpera?d&&(d.style.OTabSize=this._tabSize+""):537.1<=b.isWebkit?d&&(d.style.tabSize=this._tabSize+""):4<=b.isFirefox?d&&(d.style.MozTabSize=this._tabSize+
""):8!==this._tabSize&&(this._customTabSize=this._tabSize);c||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,b){this._themeClass=a;var c="textview",d=this._theme.getThemeClass();d&&(c+=" "+d);this._themeClass&&d!==this._themeClass&&(c+=
" "+this._themeClass);this._rootDiv.className=c;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var c=this._clientDiv;this._wrapMode?(c.style.whiteSpace="pre-wrap",c.style.wordWrap="break-word"):(c.style.whiteSpace="pre",c.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,c,d){if(this._clientDiv){var e=this._model,f=this._getSelection(),h=this._getScroll(),g=f.getCaret(),m=f.start,
n=f.end,q=e.getLineAtOffset(m),k=e.getLineAtOffset(n),l=Math.max(Math.max(m,e.getLineStart(k)),n-1),e=this._getClientWidth(),s=this._getClientHeight(),t=e/4,A=this._getBoundsAtOffset(g===m?m:l),u=A.left,y=A.right,v=A.top,x=A.bottom,z=0,C="object"===typeof c;if((a||C)&&!f.isEmpty())A=this._getBoundsAtOffset(g===n?m:l),z=(A.bottom>x?A.bottom:x)-(A.top<v?A.top:v),a&&(A.top===v?g===m?y=u+Math.min(A.right-u,e):u=y-Math.min(y-A.left,e):g===m?x=v+Math.min(A.bottom-v,s):v=x-Math.min(x-A.top,s));a=0;u<h.x&&
(a=Math.min(u-h.x,-t));y>h.x+e&&(a=Math.max(y-h.x-e,t));f=0;v<h.y?f=v-h.y:x>h.y+s&&(f=x-h.y-s);d&&(0<d?0<f&&(f=Math.max(f,d)):0>f&&(f=Math.min(f,d)));d=C&&"always"===c.scrollPolicy;if(0!==a||0!==f||d)return C?(d=0<f,0===f&&(f=v-h.y),h=c.viewAnchor||"caret",v=c.selectionAnchor||"caret",c=Math.min(Math.max(0,c.viewAnchorOffset||0)),f="top"===h?f+Math.floor(d?(1-c)*s:-c*s):"bottom"===h?f+Math.floor(d?c*s:-(1-c)*s):"center"===h?f+Math.floor(d?s/2+c*s:s/2-(1-c)*s):f+Math.floor(d?c*s:-c*s),q!==k&&("top"===
v&&g!==m?f+=Math.floor(-z):"bottom"===v&&g!==n?f+=Math.floor(z):"center"===v&&(f+=Math.floor(z/2)))):0!==f&&"number"===typeof c&&(0>c&&(c=0),1<c&&(c=1),f+=Math.floor(0<f?c*s:-c*s)),this._scrollViewAnimated(a,f,b),s!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;b&&b();return!1}},_startIME:function(){if(-1===this._imeOffset){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},
_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];A(b.target,b.type,b.handler)}this._handlers=null;this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},_updateDOMSelection:function(){if(!(0<
this._redrawCount)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,c=b.getLineAtOffset(a.start),d=b.getLineAtOffset(a.end),e=this._getLineNext();if(e){var f=this._getLinePrevious(),h;c<e.lineIndex?(c=e,h=b.getLineStart(e.lineIndex)):c>f.lineIndex?(c=f,h=b.getLineStart(f.lineIndex)):(c=this._getLineNode(c),h=a.start);d<e.lineIndex?(d=e,b=b.getLineStart(e.lineIndex)):d>f.lineIndex?(d=f,b=b.getLineStart(f.lineIndex)):(d=this._getLineNode(d),b=a.end);this._setDOMSelection(c,
h,d,b,a.caret)}}},_update:function(a){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1);var c=this._clientDiv,d=this._viewDiv;if(c){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var e=this._model,f=this._getScroll(!1),h=this._getViewPadding(),g=e.getLineCount(),m=this._getLineHeight(),n=!1,q=!1,k=!1,l=this._metrics.scrollWidth;this._wrapMode&&(c.style.width=(this._metrics.wrapWidth||
this._getClientWidth())+"px");var s,t,A,u,y=0,x=0,z;if(this._lineHeight){for(;x<g;){z=this._getLineHeight(x);if(y+z>f.y)break;y+=z;x++}s=x;t=Math.max(0,s-1);A=e=f.y-y;0<s&&(e+=this._getLineHeight(s-1))}else u=Math.max(0,f.y)/m,s=Math.floor(u),t=Math.max(0,s-1),e=Math.round((u-t)*m),A=Math.round((u-s)*m);this._topIndexY=A;u=this._rootDiv;var C=u.clientWidth,P=u.clientHeight;if(a){m=0;this._leftDiv&&(s=this._leftDiv.getBoundingClientRect(),m=s.right-s.left);s=this._getClientWidth();u=this._getClientHeight();
q=s;for(this._wrapMode?this._metrics.wrapWidth&&(q=this._metrics.wrapWidth):q=Math.max(this._maxLineWidth,q);x<g;)z=this._getLineHeight(x,!1),y+=z,x++;g=y}else{u=this._getClientHeight();A=Math.min(s+Math.floor((u+A)/m),g-1);var f=Math.min(A+1,g-1),L;for(z=c.firstChild;z;){L=z.lineIndex;var M=z.nextSibling;if(!(t<=L&&L<=f)||z.lineRemoved||-1===z.lineIndex)this._mouseWheelLine===z?(z.style.display="none",z.lineIndex=-1):c.removeChild(z);z=M}z=this._getLineNext();var M=d.ownerDocument,N=M.createDocumentFragment();
for(L=t;L<=f;L++)!z||z.lineIndex>L?(new v(this,L)).create(N,null):(N.firstChild&&(c.insertBefore(N,z),N=M.createDocumentFragment()),z&&z.lineChanged&&(z=(new v(this,L)).create(N,z),z.lineChanged=!1),z=this._getLineNext(z));N.firstChild&&c.insertBefore(N,z);b.isWebkit&&!this._wrapMode&&(c.style.width="0x7fffffffpx");z=this._getLineNext();L=u+e;for(N=!1;z;)t=z.lineWidth,void 0===t&&(M=z._line.getBoundingClientRect(),t=z.lineWidth=Math.ceil(M.right-M.left),M=M.bottom-M.top,this._lineHeight?this._lineHeight[z.lineIndex]=
M:0!==m&&0!==M&&Math.ceil(m)!==Math.ceil(M)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[z.lineIndex]=M)),this._lineHeight&&!N&&(L-=this._lineHeight[z.lineIndex],0>L&&(A=z.lineIndex,N=!0)),this._wrapMode||(t>=this._maxLineWidth&&(this._maxLineWidth=t,this._maxLineIndex=z.lineIndex),this._checkMaxLineIndex===z.lineIndex&&(this._checkMaxLineIndex=-1)),z.lineIndex===s&&(this._topChild=z),z.lineIndex===A&&(this._bottomChild=z),z=this._getLineNext(z);for(-1!==this._checkMaxLineIndex&&
(L=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=L&&L<g&&(m=new v(this,L),M=m.getBoundingClientRect(),t=M.right-M.left,t>=this._maxLineWidth&&(this._maxLineWidth=t,this._maxLineIndex=L),m.destroy()));x<g;)z=this._getLineHeight(x,x<=A),y+=z,x++;g=y;this._updateRuler(this._leftDiv,s,f,P);this._updateRuler(this._rightDiv,s,f,P);this._updateRuler(this._marginDiv,s,f,P);m=0;this._leftDiv&&(s=this._leftDiv.getBoundingClientRect(),m=s.right-s.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),
f=f.right-f.left);d.style.left=m+"px";d.style.right=f+"px";f=this._scrollDiv;f.style.height=g+"px";s=this._getClientWidth();!this._singleMode&&!this._wrapMode&&(y=n=u,(x="scroll"===d.style.overflowX)?n+=l:y-=l,z=A=s,(t="scroll"===d.style.overflowY)?A+=l:z-=l,u=n,s=A,g>u&&(k=!0,s=z),this._maxLineWidth>s&&(q=!0,u=y,g>u&&(k=!0,s=z)),x!==q&&(d.style.overflowX=q?"scroll":"hidden"),t!==k&&(d.style.overflowY=k?"scroll":"hidden"),n=x!==q||t!==k);k=s;this._wrapMode?this._metrics.wrapWidth&&(k=this._metrics.wrapWidth):
k=Math.max(this._maxLineWidth,k);q=k;if((!b.isIE||9<=b.isIE)&&this._maxLineWidth>s)k+=h.right+h.left;f.style.width=k+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=k+"px");f=this._getScroll(!1)}this._vScrollDiv&&(k=u-8,y=Math.max(15,Math.ceil(Math.min(1,k/(g+h.top+h.bottom))*k)),this._vScrollDiv.style.left=m+s-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*k/g))+"px",this._vScrollDiv.style.height=y+"px");!this._wrapMode&&this._hScrollDiv&&(k=s-8,y=Math.max(15,Math.ceil(Math.min(1,
k/(this._maxLineWidth+h.left+h.right))*k)),this._hScrollDiv.style.left=m+Math.floor(Math.max(0,Math.floor(f.x*k/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=u-9+"px",this._hScrollDiv.style.width=y+"px");x=f.x;y=this._clipDiv;k=this._overlayDiv;if(A=this._marginDiv)A.style.left=-x+m+this._metrics.marginWidth+h.left+"px",A.style.bottom=("scroll"===d.style.overflowX?l:0)+"px";y?(y.scrollLeft=x,y.scrollTop=0,d=m+h.left,l=h.top,a=s,m=u,x=0,A=-e,0===f.x&&(d-=h.left,a+=h.left,x=h.left),f.x+s===
q&&(a+=h.right),0===f.y&&(l-=h.top,m+=h.top,A+=h.top),f.y+u===g&&(m+=h.bottom),y.style.left=d+"px",y.style.top=l+"px",y.style.right=C-a-d+"px",y.style.bottom=P-m-l+"px",c.style.left=x+"px",c.style.top=A+"px",c.style.width=q+"px",c.style.height=u+e+"px",k&&(k.style.left=c.style.left,k.style.top=c.style.top,k.style.width=c.style.width,k.style.height=c.style.height)):(d=x,l=e,C=x+s,P=e+u,0===d&&(d-=h.left),0===l&&(l-=h.top),C===q&&(C+=h.right),f.y+u===g&&(P+=h.bottom),c.style.clip="rect("+l+"px,"+C+
"px,"+P+"px,"+d+"px)",c.style.left=-x+m+h.left+"px",c.style.width=(this._wrapMode||b.isWebkit?q:s+x)+"px",a||(c.style.top=-e+h.top+"px",c.style.height=u+e+"px"),k&&(k.style.clip=c.style.clip,k.style.left=c.style.left,k.style.width=c.style.width,a||(k.style.top=c.style.top,k.style.height=c.style.height)));this._updateDOMSelection();n&&(c=this._ensureCaretVisible,this._ensureCaretVisible=!1,c&&this._showCaret(),this._queueUpdate())}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?(a.style.overflowX=
"hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,c,d,e){if(a){var h=this._parent.ownerDocument,g=this._getLineHeight(),m=this._getViewPadding();for(a=a.firstChild;a;){var n=a._ruler,k=g,q=n.getOverview();"page"===q&&(k+=this._topIndexY);a.style.top=-k+"px";a.style.height=e+k+"px";a.rulerChanged&&f(n.getRulerStyle(),a);var l,s=a.firstChild;s?(l=s,s=s.nextSibling):(l=b.createElement(h,"div"),l.style.visibility="hidden",a.appendChild(l));var t;if(a.rulerChanged&&
l){k=-1;if(t=n.getWidestAnnotation())f(t.style,l),t.html&&(l.innerHTML=t.html);l.lineIndex=k;l.style.height=g+m.top+"px"}var A;if("page"===q){for(n=n.getAnnotations(c,d+1);s;)k=s.lineIndex,t=s.nextSibling,(!(c<=k&&k<=d)||s.lineChanged)&&a.removeChild(s),s=t;s=a.firstChild.nextSibling;A=h.createDocumentFragment();for(k=c;k<=d;k++)if(!s||s.lineIndex>k){l=b.createElement(h,"div");if(t=n[k])f(t.style,l),t.html&&(l.innerHTML=t.html),l.annotation=t;l.lineIndex=k;l.style.height=this._getLineHeight(k)+"px";
A.appendChild(l)}else A.firstChild&&(a.insertBefore(A,s),A=h.createDocumentFragment()),s&&(s=s.nextSibling);A.firstChild&&a.insertBefore(A,s)}else{t=this._getClientHeight();k=this._model.getLineCount();s=t+m.top+m.bottom-2*this._metrics.scrollWidth;q=g*k<s?g:s/k;if(a.rulerChanged){for(t=a.childNodes.length;1<t;)a.removeChild(a.lastChild),t--;n=n.getAnnotations(0,k);A=h.createDocumentFragment();for(var u in n)k=u>>>0,0>k||(l=b.createElement(h,"div"),t=n[u],f(t.style,l),l.style.position="absolute",
l.style.top=this._metrics.scrollWidth+g+Math.floor(k*q)+"px",t.html&&(l.innerHTML=t.html),l.annotation=t,l.lineIndex=k,A.appendChild(l));a.appendChild(A)}else if(a._oldTrackHeight!==s)for(l=a.firstChild?a.firstChild.nextSibling:null;l;)l.style.top=this._metrics.scrollWidth+g+Math.floor(l.lineIndex*q)+"px",l=l.nextSibling;a._oldTrackHeight=s}a.rulerChanged=!1;a=a.nextSibling}}},_updateStyleSheet:function(){var a="";b.isWebkit&&0<this._metrics.scrollWidth&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
b.isFirefox&&b.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var c=this._clientDiv.ownerDocument,d=c.getElementById("_textviewStyle");if(d)d.removeChild(d.firstChild),d.appendChild(c.createTextNode(a));else{d=b.createElement(c,"style");d.id="_textviewStyle";var e=c.getElementsByTagName("head")[0]||c.documentElement;d.appendChild(c.createTextNode(a));e.insertBefore(d,e.firstChild)}}},_updateStyle:function(a){!a&&
b.isIE&&(this._rootDiv.style.lineHeight="normal");var c=this._metrics=this._calculateMetrics();this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=b.isIE?c.lineHeight-(c.lineTrim.top+c.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};e.EventTarget.addMixin(x.prototype);return{TextView:x}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(g,l){function k(e){this._model=e;this._projections=[];var d=this;this._listener={onChanged:function(e){d._onChanged(e)},onChanging:function(e){d._onChanging(e)}};e.addEventListener("postChanged",this._listener.onChanged);e.addEventListener("preChanging",this._listener.onChanging)}k.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(e){if(e){var d=this._model,h=this._projections;e._lineIndex=d.getLineAtOffset(e.start);e._lineCount=d.getLineAtOffset(e.end)-e._lineIndex;var b=e.text;b||(b="");e._model="string"===typeof b?new g.TextModel(b,d.getLineDelimiter()):b;var d=this.mapOffset(e.start,!0),b=e.end-e.start,f=e._lineCount,c=e._model.getCharCount(),m=e._model.getLineCount()-1,a={type:"Changing",text:e._model.getText(),
start:d,removedCharCount:b,addedCharCount:c,removedLineCount:f,addedLineCount:m};this.onChanging(a);a=this._binarySearch(h,e.start);h.splice(a,0,e);this.onChanged({type:"Changed",start:d,removedCharCount:b,addedCharCount:c,removedLineCount:f,addedLineCount:m})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(e,d){var h=this._projections,b=0,f,c;if(d){for(f=0;f<h.length;f++){c=h[f];if(c.start>e)break;if(c.end>e)return-1;b+=
c._model.getCharCount()-(c.end-c.start)}return e+b}for(f=0;f<h.length;f++){c=h[f];if(c.start>e-b)break;var g=c._model.getCharCount();if(c.start+g>e-b)return-1;b+=g-(c.end-c.start)}return e-b},removeProjection:function(e){var d,h=0;for(d=0;d<this._projections.length;d++){var b=this._projections[d];if(b===e){e=b;break}h+=b._model.getCharCount()-(b.end-b.start)}if(d<this._projections.length){var b=this._model,h=e.start+h,f=e.end-e.start,c=e._lineCount,g=e._model.getCharCount(),a=e._model.getLineCount()-
1;e={type:"Changing",text:b.getText(e.start,e.end),start:h,removedCharCount:g,addedCharCount:f,removedLineCount:a,addedLineCount:c};this.onChanging(e);this._projections.splice(d,1);this.onChanged({type:"Changed",start:h,removedCharCount:g,addedCharCount:f,removedLineCount:a,addedLineCount:c})}},_binarySearch:function(e,d){for(var h=e.length,b=-1,f;1<h-b;)f=Math.floor((h+b)/2),d<=e[f].start?h=f:b=f;return h},getCharCount:function(){for(var e=this._model.getCharCount(),d=this._projections,h=0;h<d.length;h++)var b=
d[h],e=e+(b._model.getCharCount()-(b.end-b.start));return e},getLine:function(e,d){if(0>e)return null;var h=this._model,b=this._projections,f=0,c=[],g=0,a,n,k;for(a=0;a<b.length;a++){k=b[a];if(k._lineIndex>=e-f)break;n=k._model.getLineCount()-1;if(k._lineIndex+n>=e-f){g=e-(k._lineIndex+f);if(g<n)return k._model.getLine(g,d);c.push(k._model.getLine(n))}g=k.end;f+=n-k._lineCount}for(g=Math.max(g,h.getLineStart(e-f));a<b.length;a++){k=b[a];if(k._lineIndex>e-f)break;c.push(h.getText(g,k.start));n=k._model.getLineCount()-
1;if(k._lineIndex+n>e-f)return c.push(k._model.getLine(0,d)),c.join("");c.push(k._model.getText());g=k.end;f+=n-k._lineCount}b=h.getLineEnd(e-f,d);g<b&&c.push(h.getText(g,b));return c.join("")},getLineAtOffset:function(e){for(var d=this._model,h=this._projections,b=0,f=0,c=0;c<h.length;c++){var g=h[c];if(g.start>e-b)break;var a=g._model.getCharCount();if(g.start+a>e-b){h=e-(g.start+b);f+=g._model.getLineAtOffset(h);b+=h;break}f+=g._model.getLineCount()-1-g._lineCount;b+=a-(g.end-g.start)}return d.getLineAtOffset(e-
b)+f},getLineCount:function(){for(var e=this._projections,d=this._model.getLineCount(),h=0;h<e.length;h++)var b=e[h],d=d+(b._model.getLineCount()-1-b._lineCount);return d},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(e,d){if(0>e)return-1;for(var h=this._model,b=this._projections,f=0,c=0,g=0;g<b.length;g++){var a=b[g];if(a._lineIndex>e-f)break;var n=a._model.getLineCount()-1;if(a._lineIndex+n>e-f)return a._model.getLineEnd(e-(a._lineIndex+f),d)+a.start+c;c+=
a._model.getCharCount()-(a.end-a.start);f+=n-a._lineCount}return h.getLineEnd(e-f,d)+c},getLineStart:function(e){if(0>e)return-1;for(var d=this._model,h=this._projections,b=0,f=0,c=0;c<h.length;c++){var g=h[c];if(g._lineIndex>=e-b)break;var a=g._model.getLineCount()-1;if(g._lineIndex+a>=e-b)return g._model.getLineStart(e-(g._lineIndex+b))+g.start+f;f+=g._model.getCharCount()-(g.end-g.start);b+=a-g._lineCount}return d.getLineStart(e-b)+f},getText:function(e,d){void 0===e&&(e=0);var h=this._model,b=
this._projections,f=0,c=[],g,a,n;for(g=0;g<b.length;g++){a=b[g];if(a.start>e-f)break;n=a._model.getCharCount();if(a.start+n>e-f){if(void 0!==d&&a.start+n>d-f)return a._model.getText(e-(a.start+f),d-(a.start+f));c.push(a._model.getText(e-(a.start+f)));e=a.end+f+n-(a.end-a.start)}f+=n-(a.end-a.start)}var k=e-f;if(void 0!==d){for(;g<b.length;g++){a=b[g];if(a.start>d-f)break;c.push(h.getText(k,a.start));n=a._model.getCharCount();if(a.start+n>d-f)return c.push(a._model.getText(0,d-(a.start+f))),c.join("");
c.push(a._model.getText());k=a.end;f+=n-(a.end-a.start)}c.push(h.getText(k,d-f))}else{for(;g<b.length;g++)a=b[g],c.push(h.getText(k,a.start)),c.push(a._model.getText()),k=a.end;c.push(h.getText(k))}return c.join("")},_onChanged:function(e){e=this._change;var d=e.baseStart,h=e.baseEnd,b,f,c=this._projections;for(b=0;b<c.length&&!(f=c[b],f.end>d);b++);var g=b;for(b=0;b<c.length&&!(f=c[b],f.start>=h);b++);var a=b,n=this._model,d=e.baseText.length-(h-d);for(b=a;b<c.length;b++)f=c[b],f.start+=d,f.end+=
d,f._lineIndex=n.getLineAtOffset(f.start);f=c.splice(g,a-g);for(b=0;b<f.length;b++)f[b].annotation&&f[b].annotation._expand();this.onChanged({type:"Changed",start:e.start,removedCharCount:e.removedCharCount,addedCharCount:e.addedCharCount,removedLineCount:e.removedLineCount,addedLineCount:e.addedLineCount});this._change=void 0},_onChanging:function(e){var d=!!this._change,h=this._change||{},b=e.start,f=b+e.removedCharCount;h.baseStart=b;h.baseEnd=f;h.baseText=e.text;h.addedLineCount=e.addedLineCount;
if(!d){this._change=h;h.text=e.text;var c=this._projections,g,a,n;e=function(b){for(g=a=0;a<c.length;a++){n=c[a];if(n.start>b)break;if(n.end>b)return-1;g+=n._model.getCharCount()-(n.end-n.start)}return b+g};h.start=e(b);-1===h.start&&(h.text=this._model.getText(n.start,b)+h.text,h.addedLineCount+=this._model.getLineAtOffset(b)-this._model.getLineAtOffset(n.start),h.start=n.start+g);h.end=e(f);-1===h.end&&(h.text+=this._model.getText(f,n.end),h.addedLineCount+=this._model.getLineAtOffset(n.end)-this._model.getLineAtOffset(f),
h.end=n.start+g)}h.addedCharCount=h.text.length;h.removedCharCount=h.end-h.start;h.removedLineCount=this.getLineAtOffset(h.end)-this.getLineAtOffset(h.start);this.onChanging({type:"Changing",text:h.text,start:h.start,removedCharCount:h.removedCharCount,addedCharCount:h.addedCharCount,removedLineCount:h.removedLineCount,addedLineCount:h.addedLineCount})},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e){this._model.setLineDelimiter(e)},
setText:function(e,d,h){function b(b){for(c=g=0;g<f.length;g++){a=f[g];if(a.start>b-c)break;var d=a._model.getCharCount();if(a.start+d>b-c)return-1;c+=d-(a.end-a.start)}return b-c}this._change={text:e||"",start:d||0,end:void 0===h?this.getCharCount():h};var f=this._projections,c,g,a,n,k;e=b(this._change.start);-1===e&&(n={projection:a,start:this._change.start-(a.start+c)},e=a.end);d=b(this._change.end);-1===d&&(k={projection:a,end:this._change.end-(a.start+c)},d=a.start);n&&k&&n.projection===k.projection?
a._model.setText(this._change.text,n.start,k.end):(this._model.setText(this._change.text,e,d),n&&(a=n.projection,a._model.setText("",n.start)),k&&(a=k.projection,a._model.setText("",0,k.end),a.start=a.end,a._lineCount=0));this._change=void 0}};l.EventTarget.addMixin(k.prototype);return{ProjectionTextModel:k}});
define("orion/editor/tooltip","i18n!orion/editor/nls/messages orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/util orion/util".split(" "),function(g,l,k,e,d,h){function b(b){this._view=b;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(b.getOptions("parent").ownerDocument)}b.getTooltip=function(d){d._tooltip||(d._tooltip=new b(d));return d._tooltip};b.prototype={_create:function(b){if(!this._tooltipDiv){var c=
this._tooltipDiv=h.createElement(b,"div");c.tabIndex=0;c.className="textviewTooltip";c.setAttribute("aria-live","assertive");c.setAttribute("aria-atomic","true");var e=this._tooltipContents=h.createElement(b,"div");c.appendChild(e);b.body.appendChild(c);var a=this;d.addEventListener(c,"mouseover",function(b){a._hideDelay&&(b=a._getWindow(),a._delayedHideTimeout&&(b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null),a._hideTimeout&&(b.clearTimeout(a._hideTimeout),a._hideTimeout=null),
a._nextTarget=null)},!1);d.addEventListener(c,"mouseout",function(b){b=b.relatedTarget||b.toElement;!(b===c||a._hasFocus())&&(!b||!d.contains(c,b))&&a._hide()},!1);d.addEventListener(c,"keydown",function(b){27===b.keyCode&&a._hide()},!1);d.addEventListener(b,"mousedown",this._mouseDownHandler=function(b){a.isVisible()&&(d.contains(c,b.target||b.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.destroy()});this._hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;
return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);d.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var b=this._tooltipDiv;return!b?!1:d.contains(b,b.ownerDocument.activeElement)},hide:function(b){void 0===b&&(b=this._hideDelay);var c=this._getWindow();this._delayedHideTimeout&&(c.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var d=this;b?d._delayedHideTimeout=c.setTimeout(function(){d._delayedHideTimeout=null;d._hide();d.setTarget(d._nextTarget,0)},b):(d._hide(),d.setTarget(d._nextTarget,0))},_hide:function(){var b=this._tooltipDiv;b&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),b.style.visibility="hidden",b=this._getWindow(),this._showTimeout&&(b.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(b.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(b.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(b.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(b,c,d){if(this.isVisible())this._hasFocus()||(this._nextTarget=b,this.hide(d));else if(this._target=b){var a=
this;b=a._getWindow();a._showTimeout&&(b.clearTimeout(a._showTimeout),a._showTimeout=null);0===c?a.show(!0):a._showTimeout=b.setTimeout(function(){a._showTimeout=null;a.show(!0)},c?c:a._showDelay)}},show:function(b){if(this._target){var c=this._target.getTooltipInfo();if(c){var d=this._tooltipDiv,a=this._tooltipContents;d.style.left=d.style.right=d.style.width=d.style.height=a.style.width=a.style.height="auto";var h=c.contents;h instanceof Array&&(h=this._getAnnotationContents(h));if("string"===typeof h)a.innerHTML=
h;else if(this._isNode(h))a.appendChild(h);else if(h instanceof e.ProjectionTextModel){var g=this._view,k=g.getOptions();k.wrapMode=!1;k.parent=a;var t=k.themeClass;t?((t=t.replace("tooltipTheme",""))&&(t=" "+t),t="tooltipTheme"+t):t="tooltipTheme";k.themeClass=t;k=this._contentsView=new l.TextView(k);k.addEventListener("LineStyle",function(a){g.onLineStyle(a)});k.setModel(h);h=k.computeSize();a.style.width=h.width+"px";a.style.height=h.height+"px";k.resize()}else return;a=d.ownerDocument.documentElement;
"right"===c.anchor?(h=a.clientWidth-c.x,d.style.right=h+"px"):(h=parseInt(this._getNodeStyle(d,"padding-left","0"),10),h+=parseInt(this._getNodeStyle(d,"border-left-width","0"),10),h=c.x-h,d.style.left=h+"px");d.style.maxWidth=a.clientWidth-h-10+"px";h=parseInt(this._getNodeStyle(d,"padding-top","0"),10);h+=parseInt(this._getNodeStyle(d,"border-top-width","0"),10);h=c.y-h;d.style.top=h+"px";d.style.maxHeight=a.clientHeight-h-10+"px";d.style.opacity="1";d.style.visibility="visible";if(b){var y=this,
u=this._getWindow();y._hideTimeout=u.setTimeout(function(){y._hideTimeout=null;var a=parseFloat(y._getNodeStyle(d,"opacity","1"));y._fadeTimeout=u.setInterval(function(){"visible"===d.style.visibility&&0<a?(a-=0.1,d.style.opacity=a):y._hide()},y._fadeDelay/10)},y._autoHideDelay)}}}},_getAnnotationContents:function(b){function c(a,b){var c=v.getLineStart(v.getLineAtOffset(a)),d=v.getLineEnd(v.getLineAtOffset(b),!0);return v.getText(c,d)}function m(a){var b=a.title,e=h.createElement(t,"div");e.className=
"tooltipRow";a.html&&(e.innerHTML=a.html,e.lastChild&&d.addEventListener(e.lastChild,"click",function(b){b=a.start;var c=a.end;u.getBaseModel&&(b=u.mapOffset(b,!0),c=u.mapOffset(c,!0));y.setSelection(b,c,1/3,function(){l._hide()})},!1),e.appendChild(t.createTextNode("\u00a0")));b||(b=c(a.start,a.end));"function"===typeof b&&(b=a.title());if("string"===typeof b){var f=h.createElement(t,"span");f.appendChild(t.createTextNode(b));b=f}e.appendChild(b);return e}for(var a,n=[],k=0;k<b.length;k++)a=b[k],
""!==a.title&&!a.groupAnnotation&&n.push(a);b=n;if(0===b.length)return null;var l=this,t=this._tooltipDiv.ownerDocument,y=this._view,u=y.getModel(),v=u.getBaseModel?u.getBaseModel():u;if(1===b.length){a=b[0];if(void 0!==a.title)return a=m(a),a.firstChild&&((b=a.firstChild.className)&&(b+=" "),a.firstChild.className=b+"single"),a;b=new e.ProjectionTextModel(v);n=v.getLineStart(v.getLineAtOffset(a.start));k=v.getCharCount();a.end!==k&&b.addProjection({start:a.end,end:k});0<n&&b.addProjection({start:0,
end:n});return b}n=h.createElement(t,"div");a=h.createElement(t,"em");a.appendChild(t.createTextNode(g.multipleAnnotations));n.appendChild(a);for(k=0;k<b.length;k++)a=b[k],(a=m(a))&&n.appendChild(a);return n},_getNodeStyle:function(b,c,d){var a;if(b&&(a=b.style[c],!a))if(b.currentStyle){for(a=0;-1!==(a=c.indexOf("-",a));)c=c.substring(0,a)+c.substring(a+1,a+2).toUpperCase()+c.substring(a+2);a=b.currentStyle[c]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(c):null;
return a||d},_isNode:function(b){return"object"===typeof Node?b instanceof Node:b&&"object"===typeof b&&"number"===typeof b.nodeType&&"string"===typeof b.nodeName}};return{Tooltip:b}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(g,l){function k(){}function e(a,b,c){this.start=a;this.end=b;this._projectionModel=c;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function d(a,b){var c=a.lastIndexOf("."),c=a.substring(c+1),d={title:g[c],style:{styleClass:"annotation "+c},html:"\x3cdiv class\x3d'annotationHTML "+c+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+c}};b?d.lineStyle=
{styleClass:"annotationLine "+c}:d.rangeStyle={styleClass:"annotationRange "+c};k.registerType(a,d)}function h(){}function b(a,b){for(var c=a.length,d=-1,e;1<c-d;)e=Math.floor((c+d)/2),b<=a[e].start?c=e:d=e;return c}function f(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function c(a,b){this._view=a;this._annotationModel=b;var c=this;this._listener={onDestroy:function(a){c._onDestroy(a)},onLineStyle:function(a){c._onLineStyle(a)},
onChanged:function(a){c._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}e.prototype={_expandedHTML:"\x3cdiv class\x3d'annotationHTML expanded'\x3e\x3c/div\x3e",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"\x3cdiv class\x3d'annotationHTML collapsed'\x3e\x3c/div\x3e",_collapsedStyle:{styleClass:"annotation collapsed"},_collapse:function(){if(!this.expanded)return!1;
this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_collapseImpl:function(a){if(this._collapse()){a&&this._forEachOverlaping(function(a){a.expanded||(a._expandImpl(!1),a._recollapse=!0)});a=this._projectionModel;
var b=a.getBaseModel();this._projection={annotation:this,start:b.getLineStart(b.getLineAtOffset(this.start)+1),end:b.getLineEnd(b.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},_expandImpl:function(a){this._expand()&&(this._projectionModel.removeProjection(this._projection),a&&this._forEachOverlaping(function(a){a._recollapse&&(a._collapseImpl(!1),a._recollapse=!1)}))},_forEachOverlaping:function(a){if(this._annotationModel)for(var b=this._annotationModel.getAnnotations(this.start,
this.end);b.hasNext();){var c=b.next();c!==this&&c.type===k.ANNOTATION_FOLDING&&a.call(this,c)}},collapse:function(){this._recollapse=!1;this._collapseImpl(!0)},expand:function(){this._recollapse=!1;this._expandImpl(!0)}};k.ANNOTATION_ERROR="orion.annotation.error";k.ANNOTATION_WARNING="orion.annotation.warning";k.ANNOTATION_TASK="orion.annotation.task";k.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";k.ANNOTATION_BOOKMARK="orion.annotation.bookmark";k.ANNOTATION_FOLDING="orion.annotation.folding";
k.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";k.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";k.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";k.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";k.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";k.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";k.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";k.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";
k.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";k.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";k.ANNOTATION_BLAME="orion.annotation.blame";k.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var m={};k.registerType=function(a,b){var c=b;"function"!==typeof c&&(c=function(a,b,c){this.start=a;this.end=b;void 0!==c&&(this.title=c)},c.prototype=b);c.prototype.type=a;m[a]=c;return a};k.createAnnotation=function(a,b,c,d){return new (this.getType(a))(b,c,d)};k.getType=
function(a){return m[a]};d(k.ANNOTATION_ERROR);d(k.ANNOTATION_WARNING);d(k.ANNOTATION_TASK);d(k.ANNOTATION_BREAKPOINT);d(k.ANNOTATION_BOOKMARK);d(k.ANNOTATION_CURRENT_BRACKET);d(k.ANNOTATION_MATCHING_BRACKET);d(k.ANNOTATION_CURRENT_SEARCH);d(k.ANNOTATION_MATCHING_SEARCH);d(k.ANNOTATION_READ_OCCURRENCE);d(k.ANNOTATION_WRITE_OCCURRENCE);d(k.ANNOTATION_SELECTED_LINKED_GROUP);d(k.ANNOTATION_CURRENT_LINKED_GROUP);d(k.ANNOTATION_LINKED_GROUP);d(k.ANNOTATION_CURRENT_LINE,!0);d(k.ANNOTATION_BLAME,!0);d(k.ANNOTATION_CURRENT_BLAME,
!0);k.registerType(k.ANNOTATION_FOLDING,e);h.addMixin=function(a){var b=h.prototype,c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};h.prototype={addAnnotationType:function(a,b){this._annotationTypes||(this._annotationTypes=[]);var c=b-1;void 0==b||!(0<=c&&c<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(c,0,a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a)return b+
1;return 0},getAnnotationsByType:function(a,b,c){a=a.getAnnotations(b,c);for(c=[];a.hasNext();)b=a.next(),0!==this.getAnnotationTypePriority(b.type)&&c.push(b);var d=this;c.sort(function(a,b){return d.getAnnotationTypePriority(a.type)-d.getAnnotationTypePriority(b.type)});return c},isAnnotationTypeVisible:function(a){return 0!==this.getAnnotationTypePriority(a)},removeAnnotationType:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a){this._annotationTypes.splice(b,
1);break}}};f.prototype={addAnnotation:function(a){if(a){var c=this._annotations,d=b(c,a.start);c.splice(d,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var c=this._annotations,d,e=0,f;f=void 0===a&&void 0===b?function(){return e<c.length?c[e++]:null}:function(){for(;e<c.length;){var d=c[e++];if(a===d.start||(a>d.start?a<d.end:d.start<b))return d;if(d.start>=b)break}return null};
d=f();return{next:function(){var a=d;a&&(d=f());return a},hasNext:function(){return null!==d}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=this._annotations,c,d;if(a){c=[];for(d=b.length-1;0<=d;d--){var e=b[d];e.type===a&&(b.splice(d,1),c.splice(0,0,e),e._annotationModel=null)}}else c=b;this.onChanged({type:"Changed",removed:c,
added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);0>b||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,c){var d=this._annotations,e,f,h,g=[];if(a)for(e=a.length-1;0<=e;e--)h=a[e],f=this._getAnnotationIndex(h),0>f||(h._annotationModel=null,d.splice(f,1),g.splice(0,0,h));c||(c=[]);for(e=0;e<c.length;e++)h=c[e],f=b(d,h.start),h._annotationModel=this,d.splice(f,
0,h);this.onChanged({type:"Changed",removed:g,added:c,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_getAnnotationIndex:function(a){for(var c=this._annotations,d=b(c,a.start);d<c.length&&c[d].start===a.start;){if(c[d]===a)return d;d++}return-1},_onChanged:function(a){var b=a.start,c=a.addedCharCount,d=a.removedCharCount,e=this._annotations,f=
b+d;if(0<e.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};c-=d;for(d=0;d<e.length;d++){var h=e[d];h.start>=f?(h._oldStart=h.start,h._oldEnd=h.end,h.start+=c,h.end+=c,a.changed.push(h)):h.end<=b||(h.start<b&&f<h.end?(h._oldStart=h.start,h._oldEnd=h.end,h.end+=c,a.changed.push(h)):(e.splice(d,1),a.removed.push(h),h._annotationModel=null,h.expand&&h.expand(),d--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};l.EventTarget.addMixin(f.prototype);
c.prototype={destroy:function(){var a=this._view;a&&(a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",this._listener.onLineStyle),this.view=null);(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?a.styleClass+(" "+b.styleClass):b.styleClass;var c;b.tagName&&!a.tagName&&(a.tagName=b.tagName);if(b.style)for(c in a.style||
(a.style={}),b.style)a.style[c]||(a.style[c]=b.style[c]);if(b.attributes)for(c in a.attributes||(a.attributes={}),b.attributes)a.attributes[c]||(a.attributes[c]=b.attributes[c])}return a},_mergeStyleRanges:function(a,c){a||(a=[]);for(var d,e=b(a,c.start);e<a.length&&c;e++){var f=a[e];if(c.end<=f.start)break;if(!(c.start>=f.end)){d=this._mergeStyle({},f.style);d=this._mergeStyle(d,c.style);var h=[];h.push(e,1);c.start<f.start&&h.push({start:c.start,end:f.start,style:c.style});c.start>f.start&&h.push({start:f.start,
end:c.start,style:f.style});h.push({start:Math.max(f.start,c.start),end:Math.min(f.end,c.end),style:d});c.end<f.end&&h.push({start:c.end,end:f.end,style:f.style});c=c.end>f.end?{start:f.end,end:c.end,style:c.style}:null;Array.prototype.splice.apply(a,h)}}c&&(d=this._mergeStyle({},c.style),a.splice(e,0,{start:c.start,end:c.end,style:d}));return a},_onAnnotationModelChanged:function(a){function b(a,c){f.getBaseModel&&(a=f.mapOffset(a,!0),c=f.mapOffset(c,!0));-1!==a&&-1!==c&&d.redrawRange(a,c)}function c(a,
d){for(var f=0;f<a.length;f++)if(e.isAnnotationTypeVisible(a[f].type)){var h=a[f];b(h.start,h.end);d&&void 0!==h._oldStart&&h._oldEnd&&b(h._oldStart,h._oldEnd)}}var d=this._view;if(d){var e=this,f=d.getModel();c(a.added);c(a.removed);c(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,c=a.textView.getModel(),d=b.getTextModel(),e=a.lineStart,f=a.lineStart+a.lineText.length;d!==c&&(e=c.mapOffset(e),f=c.mapOffset(f));for(b=b.getAnnotations(e,
f);b.hasNext();)if(e=b.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,h=e.end;d!==c&&(f=c.mapOffset(f,!0),h=c.mapOffset(h,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:f,end:h,style:e.rangeStyle})}e.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,e.lineStyle))}}};h.addMixin(c.prototype);return{FoldingAnnotation:e,AnnotationType:k,AnnotationTypeList:h,AnnotationModel:f,AnnotationStyler:c}});
define("orion/editor/editor","i18n!orion/editor/nls/messages orion/editor/eventTarget orion/editor/tooltip orion/editor/annotations orion/objects orion/util".split(" "),function(g,l,k,e,d,h){function b(b){b=b||{};this._domNode=b.domNode;this._model=b.model;this._undoStack=b.undoStack;this._statusReporter=b.statusReporter;this._title=null;var a=this;this._listener={onChanged:function(b){a.onChanged(b)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function f(c){c=c||{};b.call(this,c);this._textViewFactory=c.textViewFactory;this._undoStackFactory=c.undoStackFactory;this._textDNDFactory=c.textDNDFactory;this._annotationFactory=c.annotationFactory;this._foldingRulerFactory=c.foldingRulerFactory;this._lineNumberRulerFactory=c.lineNumberRulerFactory;this._contentAssistFactory=c.contentAssistFactory;this._keyBindingFactory=c.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var c=e.AnnotationType;b.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(b,a){return this.getModel().getText(b,a)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(b){return this.dispatchEvent(b)},onInputChanged:function(b){return this.dispatchEvent(b)},onChanged:function(b){this.checkDirty()},reportStatus:function(b,a,c){this._statusReporter&&this._statusReporter(b,a,c)},resize:function(){},setDirty:function(b){this._dirty!==b&&(this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(b){this._model&&this._model.setText(b)},setInput:function(b,a,c,d){this._title=b;d||(a?this.reportStatus(a,"error"):null!==c&&void 0!==c&&"string"===typeof c&&this._setModelText(c),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:b,message:a,contents:c,contentsSaved:d})},setText:function(b,a,c){this.getModel().setText(b,a,c)},uninstall:function(){this.installed=!1}};l.EventTarget.addMixin(b.prototype);f.prototype=new b;
d.mixin(f.prototype,{destroy:function(){b.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(b,a){if(this._annotationRulerVisible!==b||a)if(this._annotationRulerVisible=b,this._annotationRuler){var c=this._textView;b?c.addRuler(this._annotationRuler,0):c.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible=
b,this._foldingRuler){var c=this._textView;c.getModel().getBaseModel&&(b?c.addRuler(this._foldingRuler):c.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var c=this._textView;b?c.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):c.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible=
b,this._overviewRuler){var c=this._textView;b?c.addRuler(this._overviewRuler):c.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(b=c.mapOffset(b,a));return b},getLineAtOffset:function(b){return this.getModel().getLineAtOffset(this.mapOffset(b))},getLineStart:function(b){return this.getModel().getLineStart(b)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var b=this._textView,a=b.getSelection(),
b=b.getModel();b.getBaseModel&&(a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end));return a},_expandOffset:function(b){var a=this._textView.getModel(),d=this._annotationModel;if(d&&a.getBaseModel)for(b=d.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===c.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(b,a,c){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(b),b=e.mapOffset(b,!0));d.setCaretOffset(b,a,c)},setText:function(b,a,c){var d=this._textView,
e=d.getModel();e.getBaseModel&&(void 0!==a&&(this._expandOffset(a),a=e.mapOffset(a,!0)),void 0!==c&&(this._expandOffset(c),c=e.mapOffset(c,!0)));d.setText(b,a,c)},setSelection:function(b,a,c,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=f.mapOffset(b,!0),a=f.mapOffset(a,!0));e.setSelection(b,a,c,d)},moveSelection:function(b,a,c,d){var e=this._textView;this.setSelection(b,a||b,1/3,function(){(void 0===d||d)&&e.focus();c&&c()})},_getTooltipInfo:function(b,
a){var c=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;if(!e)return null;var f=c.getOffsetAtLocation(b,a);if(-1===f)return null;f=this.mapOffset(f);e=e.getAnnotationsByType(d,f,f+1);d=[];for(f=0;f<e.length;f++)e[f].rangeStyle&&d.push(e[f]);if(0===d.length)return null;c=c.convert({x:b,y:a},"document","page");return{contents:d,anchor:"left",x:c.x+10,y:c.y+20}},_highlightCurrentLine:function(b,a){var d=this._annotationModel;if(d){var e=this._textView;if(!e.getOptions("singleMode")){var f=
e.getModel(),h=a?f.getLineAtOffset(a.start):-1,g=f.getLineAtOffset(b.start),e=b.start===b.end,k=!a||a.start===a.end,l=f.getLineStart(g),x=f.getLineEnd(g);f.getBaseModel&&(l=f.mapOffset(l),x=f.mapOffset(x));f=this._currentLineAnnotation;if(!(h===g&&k&&e&&f&&f.start===l&&f.end===x)){var h=f?[f]:null,z;e&&(f=c.createAnnotation(c.ANNOTATION_CURRENT_LINE,l,x),z=[f]);this._currentLineAnnotation=f;d.replaceAnnotations(h,z)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty());this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack));this._contentAssistFactory&&(this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist());var d=this,a=this._textView,e=this;this._listener={onModelChanged:function(a){e.checkDirty()},onMouseOver:function(a){e._listener.onMouseMove(a)},onMouseMove:function(b){var c=
k.Tooltip.getTooltip(a);c&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY)&&(e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,c.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(b){var c=k.Tooltip.getTooltip(a);c&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY)&&(e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,
c.setTarget(null))},onScroll:function(b){(b=k.Tooltip.getTooltip(a))&&b.setTarget(null,0,0)},onSelection:function(a){e._updateCursorStatus();e._highlightCurrentLine(a.newValue,a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var f;if(f="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(d,this._undoStack,this._contentAssist))this._textActions=f.textActions,this._linkedMode=f.linkedMode,this._sourceCodeActions=f.sourceCodeActions}f=function(a,b){if(void 0!==a&&-1!==a){for(var e=this.getView().getModel(),f=this.getAnnotationModel(),h=d.mapOffset(e.getLineStart(a)),
e=d.mapOffset(e.getLineEnd(a)),g=f.getAnnotations(h,e),n=null;g.hasNext();){var k=g.next();if(k.type===c.ANNOTATION_BOOKMARK){n=k;break}}n?f.removeAnnotation(n):(n=c.createAnnotation(c.ANNOTATION_BOOKMARK,h,e),n.title=void 0,f.addAnnotation(n))}};if(this._annotationFactory){var h=a.getModel();h.getBaseModel&&(h=h.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(h))if(h=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))h.addAnnotationType(c.ANNOTATION_CURRENT_SEARCH),
h.addAnnotationType(c.ANNOTATION_MATCHING_SEARCH),h.addAnnotationType(c.ANNOTATION_ERROR),h.addAnnotationType(c.ANNOTATION_WARNING),h.addAnnotationType(c.ANNOTATION_MATCHING_BRACKET),h.addAnnotationType(c.ANNOTATION_CURRENT_BRACKET),h.addAnnotationType(c.ANNOTATION_CURRENT_LINE),h.addAnnotationType(c.ANNOTATION_READ_OCCURRENCE),h.addAnnotationType(c.ANNOTATION_WRITE_OCCURRENCE),h.addAnnotationType(c.ANNOTATION_SELECTED_LINKED_GROUP),h.addAnnotationType(c.ANNOTATION_CURRENT_LINKED_GROUP),h.addAnnotationType(c.ANNOTATION_LINKED_GROUP),
h.addAnnotationType("orion.annotation.highlightError");var h=this._annotationFactory.createAnnotationRulers(this._annotationModel),g=this._annotationRuler=h.annotationRuler;g&&(g.onDblClick=f,g.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),g.addAnnotationType(c.ANNOTATION_ERROR),g.addAnnotationType(c.ANNOTATION_WARNING),g.addAnnotationType(c.ANNOTATION_TASK),g.addAnnotationType(c.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(g=this._overviewRuler=h.overviewRuler)g.addAnnotationType(c.ANNOTATION_CURRENT_SEARCH),g.addAnnotationType(c.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(c.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(c.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(c.ANNOTATION_CURRENT_BLAME),g.addAnnotationType(c.ANNOTATION_ERROR),g.addAnnotationType(c.ANNOTATION_WARNING),g.addAnnotationType(c.ANNOTATION_TASK),g.addAnnotationType(c.ANNOTATION_BOOKMARK),g.addAnnotationType(c.ANNOTATION_MATCHING_BRACKET),
g.addAnnotationType(c.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(c.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(c.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(c.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=f,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(c.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:a});b.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var c=this._textView;c&&(c.destroy(),
this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:c}),b.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var b=
this.getModel(),a=this.getCaretOffset(),c=b.getLineAtOffset(a),b=b.getLineStart(c),a=a-b,b=this.getKeyModes(),d=0;d<b.length;d++){var e=b[d];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(h.formatMessage(g.lineColumn,c+1,a+1))},showAnnotations:function(b,a,d,e){var f=this._annotationModel;if(f){for(var h=[],g=[],k=f.getTextModel(),l=f.getAnnotations(),x;l.hasNext();)x=l.next(),-1!==a.indexOf(x.type)&&x.creatorID===this&&h.push(x);if(b)for(a=0;a<b.length;a++)if(x=b[a]){if(d)x=
d(x);else{var z;"number"===typeof x.line?(z=k.getLineStart(x.line-1),l=z+x.start-1,z=z+x.end-1):(l=x.start,z=x.end);var A=e(x);if(!A)continue;x=c.createAnnotation(A,l,z,x.description)}x.creatorID=this;g.push(x)}f.replaceAnnotations(h,g)}},showProblems:function(b){this.showAnnotations(b,[c.ANNOTATION_ERROR,c.ANNOTATION_WARNING,c.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return c.ANNOTATION_ERROR;case "warning":return c.ANNOTATION_WARNING;case "task":return c.ANNOTATION_TASK}return null})},
showOccurrences:function(b){this.showAnnotations(b,[c.ANNOTATION_READ_OCCURRENCE,c.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?c.ANNOTATION_READ_OCCURRENCE:c.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var a=this._blameRGB,f=this.getTextView().getOptions("parent").ownerDocument;if(!a){var k=h.createElement(f,"div");k.className="annotation blame";f.body.appendChild(k);var l=(f.defaultView||f.parentWindow).getComputedStyle(k).getPropertyValue("background-color");k.parentNode.removeChild(k);
var k=l.indexOf("("),t=l.indexOf(")"),l=l.substring(k+1,t);this._blameRGB=a=l.split(",").slice(0,3)}var y=function(){var a=e.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=d.mixin({},a.style);a.style.style=d.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},u=function(){var a=h.createElement(f,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n");
-1===b&&(b=this.blame.Message.length);var c=h.createElement(f,"a");c.href=this.blame.CommitLink;c.appendChild(f.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(c);a.appendChild(h.createElement(f,"br"));a.appendChild(f.createTextNode(h.formatMessage(g.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},v=this.getModel();this.showAnnotations(b,[c.ANNOTATION_BLAME,c.ANNOTATION_CURRENT_BLAME],function(b){var f=v.getLineStart(b.Start-1),h=v.getLineEnd(b.End-1,!0),f=e.AnnotationType.createAnnotation(c.ANNOTATION_BLAME,
f,h,u),h=a.slice(0);h.push(b.Shade);f.style=d.mixin({},f.style);f.style.style=d.mixin({},f.style.style);f.style.style.backgroundColor="rgba("+h.join()+")";f.groupId=b.Name;f.groupType=c.ANNOTATION_CURRENT_BLAME;f.createGroupAnnotation=y;f.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+b.AuthorImage+'"/\x3e';f.blame=b;return f})},showSelection:function(b,a,c,d,e){"number"===typeof b?("number"!==typeof a&&(a=b),this.moveSelection(b,a)):"number"===typeof c&&(b=this.getModel().getLineStart(c-
1),"number"===typeof d&&(b+=d),"number"!==typeof e&&(e=0),this.moveSelection(b,b+e))},_setModelText:function(b){this._textView&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(c,a,d,e,f){b.prototype.setInput.call(this,c,a,d,e);this._textView&&!e&&!f&&this._textView.focus()},onGotoLine:function(b,a,c,d){if(this._textView){var e=this.getModel();b=Math.max(0,Math.min(b,e.getLineCount()-1));var f=
e.getLineStart(b),h=0;void 0===c&&(c=0);"string"===typeof a?(b=e.getLine(b).indexOf(a),-1!==b&&(h=b,c=h+a.length)):(h=a,a=e.getLineEnd(b)-f,h=Math.min(h,a),c=Math.min(c,a));this.moveSelection(f+h,f+c,d)}}});return{BaseEditor:b,Editor:f}});
define("orion/editor/find","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/regex orion/objects orion/util".split(" "),function(g,l,k,e,d,h,b){function f(a){var b=a.getTextView();k.KeyMode.call(this,b);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";b.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));b.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var c=this;this._listener={onVerify:function(a){var b=c.editor,e=b.getModel(),f=b.mapOffset(a.start),b=b.mapOffset(a.end),e=e.getText(f,b);if((e=c._prefix.match(RegExp("^"+d.escape(e),"i")))&&0<e.length)c._prefix+=a.text,c._success=!0,c._status(),c.find(c._forward,!0),a.text=null},onSelection:function(){c._ignoreSelection||c.setActive(!1)}}}function c(a,b,c){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var d=this;this._listeners={onEditorFocus:function(a){d._removeCurrentAnnotation(a)}};this.setOptions(c)}}var m={};f.prototype=new k.KeyMode;h.mixin(f.prototype,{createKeyBindings:function(){var a=l.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel",
keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var c=this._prefix;if(0===c.length)return!1;var d=this.editor,e=d.getModel(),e=a?this._success?b?this._start:d.getCaretOffset()+
1:0:this._success?b?this._start:d.getCaretOffset():e.getCharCount()-1;(c=d.getModel().find({string:c,start:e,reverse:!a,caseInsensitive:c.toLowerCase()===c}).next())?(b||(this._start=e),this._ignoreSelection=this._success=!0,d.moveSelection(a?c.start:c.end,a?c.end:c.start),this._ignoreSelection=!1):this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){this._active!==a&&(this._active=a,this._prefix=
"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status())},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
a.length-1);return 0===a.length?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?g.incrementalFindStr:g.incrementalFindStrNotFound:this._success?g.incrementalFindReverseStr:g.incrementalFindReverseStrNotFound;a=b.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
m.IncrementalFind=f;c.prototype={find:function(a,b,c){this.setOptions({reverse:!a});var d=this.getFindString(),e;b&&(d=b.findString||d,e=b.count);a=this.getOptions();this.setOptions(b);b=c?this._startOffset:this.getStartOffset();if((e=this._doFind(d,b,e))&&!c)this._startOffset=e.start;this.setOptions(a);this._hideAfterFind&&this.hide();return e},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a=
this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=d.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},
hide:function(){this._visible=!1;this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null));this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var b=a;if(this._regex){for(var b="",c=!1,d=this._editor.getModel().getLineDelimiter(),e=0;e<a.length;e++){var f=a.substring(e,e+1);if(c){switch(f){case "R":b+=d;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+f}c=!1}else"\\"===f?c=!0:b+=f}c&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,c=this._processReplaceString(this.getReplaceString()),d=b.getSelection().start;if(b=b.getModel().find({string:a,start:d,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,c),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var c=this._editor,d=c.getTextView();c.reportStatus(g.replaceAll);var e=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var h=0,m=0;;){var k=f._doFind(a,h,null,!0);if(!k)break;m++;1===m&&(d.setRedraw(!1),f.startUndo());f._doReplace(k.start,k.end,a,e);h=f.getStartOffset()}0<
m&&(f.endUndo(),d.setRedraw(!0));0<h?c.reportStatus(b.formatMessage(g.replacedMatches,m)):c.reportStatus(g.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(a){if(a){if((!0===a.showAll||!1===a.showAll)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(!0===a.caseInsensitive||!1===a.caseInsensitive)this._caseInsensitive=
a.caseInsensitive;if(!0===a.wrap||!1===a.wrap)this._wrap=a.wrap;if(!0===a.wholeWord||!1===a.wholeWord)this._wholeWord=a.wholeWord;if(!0===a.incremental||!1===a.incremental)this._incremental=a.incremental;if(!0===a.regex||!1===a.regex)this._regex=a.regex;if(!0===a.findAfterReplace||!1===a.findAfterReplace)this._findAfterReplace=a.findAfterReplace;if(!0===a.hideAfterFind||!1===a.hideAfterFind)this._hideAfterFind=a.hideAfterFind;if(!0===a.reverse||!1===a.reverse)this._reverse=a.reverse;a.hasOwnProperty("findCallback")&&
(this._findCallback=a.findCallback);a.hasOwnProperty("start")&&(this._start=a.start);a.hasOwnProperty("end")&&(this._end=a.end)}},show:function(a){this._visible=!0;a&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(a));this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,b,c){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:c?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,c,d){c=c||1;var f=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var h,m;if(this._regex)try{m=this._find(a,b,d)}catch(k){f.reportStatus(k.message,
"error");return}else m=this._find(a,b,d);for(a=0;a<c&&m.hasNext();a++)h=m.next();if(!this._replacingAll){h?this._editor.reportStatus(""):this._editor.reportStatus(g.notFound,"error");if(this.isVisible()){c=e.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(m=f.getAnnotationModel())m.removeAnnotations(c),h&&m.addAnnotation(e.AnnotationType.createAnnotation(c,h.start,h.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var l=this;this._timer=window.setTimeout(function(){l._markAllOccurrences();
l._timer=null},500)}}this._findCallback?this._findCallback(h):h&&f.moveSelection(h.start,h.end,null,!1)}return h},_doReplace:function(a,b,c,d){var e=this._editor;if(!this._regex||!(d=e.getText(a,b).replace(RegExp(c,this._caseInsensitive?"i":""),d),!d))e.setText(d,a,b),e.setSelection(a,a+d.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=e.AnnotationType.ANNOTATION_MATCHING_SEARCH,c=a.getAnnotations(),d=[],f;c.hasNext();){var h=c.next();h.type===b&&
d.push(h)}if(this.isVisible()){c=this.getFindString();c=this._editor.getModel().find({string:c,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(f=[];c.hasNext();)h=c.next(),f.push(e.AnnotationType.createAnnotation(b,h.start,h.end))}a.replaceAnnotations(d,f)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(a){(a=this._editor.getAnnotationModel())&&a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};m.Find=c;return m});
define("orion/editor/actions","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/annotations orion/editor/tooltip orion/editor/find orion/util".split(" "),function(g,l,k,e,d,h){function b(a,b,c){this.editor=a;this.undoStack=b;this._incrementalFind=new d.IncrementalFind(a);this._find=c?c:new d.Find(a,b);this._lastEditLocation=null;this.init()}function f(a,b,c,d){this.editor=a;this.undoStack=b;this.contentAssist=c;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var c=k.AnnotationType,m={};b.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){this.editor.isDirty()&&(this._lastEditLocation=a.start+a.addedCharCount)}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:g.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:g.redo});a.setKeyBinding(new l.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(g.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:g.find});a.setKeyBinding(new l.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?
(this._find.find(!0,a),!0):!1}.bind(this),{name:g.findNext});a.setKeyBinding(new l.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:g.findPrevious});a.setKeyBinding(new l.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:g.incrementalFind});a.setKeyBinding(new l.KeyBinding("j",!0,!0),"incrementalFindReverse");
a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:g.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:g.unindentLines});a.setKeyBinding(new l.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:g.moveLinesUp});a.setKeyBinding(new l.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:g.moveLinesDown});a.setKeyBinding(new l.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:g.copyLinesUp});a.setKeyBinding(new l.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:g.copyLinesDown});a.setKeyBinding(new l.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:g.deleteLines});a.setKeyBinding(new l.KeyBinding("l",!h.isMac,!1,!1,h.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:g.gotoLine});a.setKeyBinding(new l.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:g.nextAnnotation});a.setKeyBinding(new l.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:g.prevAnnotation});a.setKeyBinding(new l.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:g.expand});a.setKeyBinding(new l.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:g.collapse});a.setKeyBinding(new l.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:g.expandAll});a.setKeyBinding(new l.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:g.collapseAll});a.setKeyBinding(new l.KeyBinding("q",!h.isMac,!1,!1,h.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:g.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=b.getLineStart(d),d=b.getLineEnd(c,!0),f=b.getLineCount(),h="",e=b.getText(e,d);c===f-1&&(e=(h=b.getLineDelimiter())+e);a.setText(e,d,d);a.setSelection(d+h.length,d+e.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-
1:c.end),d=b.getLineStart(d),e=b.getLineEnd(c,!0),f=b.getLineCount(),h="",e=b.getText(d,e);c===f-1&&(e+=h=b.getLineDelimiter());a.setText(e,d,d);a.setSelection(d,d+e.length-h.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=1;a&&a.count&&(c=a.count);var d=b.getSelection(),e=b.getModel(),f=e.getLineAtOffset(d.start);a=e.getLineStart(f);c=d.start!==d.end||1===c?e.getLineAtOffset(d.end>d.start?d.end-1:d.end):Math.min(f+c-1,e.getLineCount()-
1);c=e.getLineEnd(c,!0);b.setText("",a,c);return!0},expandAnnotation:function(a){var b=this.editor,c=b.getAnnotationModel();if(!c)return!0;var d=b.getModel(),e=b.getCaretOffset(),f=d.getLineAtOffset(e),e=d.getLineStart(f),f=d.getLineEnd(f,!0);d.getBaseModel&&(e=d.mapOffset(e),f=d.mapOffset(f),d.getBaseModel());for(var h,c=c.getAnnotations(e,f);!h&&c.hasNext();)d=c.next(),d.type===k.AnnotationType.ANNOTATION_FOLDING&&(h=d);h&&a!==h.expanded&&(a?h.expand():(b.setCaretOffset(h.start),h.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,c=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var d=b.getAnnotations();for(c.setRedraw(!1);d.hasNext();)b=d.next(),b.type===k.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());c.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>
d.start?d.end-1:d.end);if(e!==f){var h=[];h.push("");for(var g=e;g<=f;g++)h.push(c.getLine(g,!0));g=c.getLineStart(e);c=c.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(h.join(b),g,c);a.setSelection(g===d.start?d.start:d.start+b.length,d.end+(f-e+1)*b.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,
b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(g.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount();if(e===f-1)return!0;var d=b.getLineStart(d),c=b.getLineEnd(e,!0),h=b.getLineEnd(e+1,!0)-(c-d),g=0;e!==f-2?b=b.getText(d,c):(e=b.getLineEnd(e),
b=b.getText(e,c)+b.getText(d,e),g+=c-e);this.startUndo();a.setText("",d,c);a.setText(b,h,h);a.setSelection(h+g,h+g+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start);if(0===d)return!0;var e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount(),c=b.getLineStart(d-1),h=b.getLineStart(d),g=b.getLineEnd(e,!0),m=b.getText(h,g),k=0;e===f-1&&(e=b.getLineEnd(d-
1),d=b.getLineEnd(d-1,!0),m+=b.getText(e,d),h=e,k=d-e);this.startUndo();a.setText("",h,g);a.setText(m,c,c);a.setSelection(c,c+m.length-k);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===c.ANNOTATION_MATCHING_BRACKET||a.type===c.ANNOTATION_CURRENT_BRACKET||!h.isAnnotationTypeVisible(a.type)}var d=this.editor,f=d.getAnnotationModel();if(!f)return!0;var h=d.getOverviewRuler()||d.getAnnotationStyler();if(!h)return!0;for(var g=d.getModel(),m=d.getCaretOffset(),
k=f.getAnnotations(a?m:0,a?g.getCharCount():m),l=null;k.hasNext();){var z=k.next();if(a){if(z.start<=m)continue}else if(z.start>=m)continue;if(!b(z)&&(l=z,a))break}if(l){for(var A=[l],k=f.getAnnotations(l.start,l.start);k.hasNext();)z=k.next(),z!==l&&!b(z)&&A.push(z);var C=d.getTextView(),p=g.getLineAtOffset(l.start),w=e.Tooltip.getTooltip(C);if(!w)return d.moveSelection(l.start),!0;d.moveSelection(l.start,l.start,function(){w.setTarget({getTooltipInfo:function(){var a=C.convert({x:C.getLocationAtOffset(l.start).x,
y:C.getLocationAtOffset(g.getLineStart(p)).y},"document","page");return{contents:A,x:a.x,y:a.y+Math.floor(1.33*C.getLineHeight(p))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getOptions("tabSize"),g=Array(h+1).join(" "),m=[],k=b=0,l=e;l<=f;l++){var C=c.getLine(l,!0);if(c.getLineStart(l)!==
c.getLineEnd(l))if(0===C.indexOf("\t"))C=C.substring(1),b++;else if(0===C.indexOf(g))C=C.substring(h),b+=h;else return!0;l===e&&(k=b);m.push(C)}e=c.getLineStart(e);h=c.getLineEnd(f,!0);c=c.getLineStart(f);a.setText(m.join(""),e,h);f=e===d.start?d.start:d.start-k;d=Math.max(f,d.end-b+(d.end===c+1&&d.start!==d.end?1:0));a.setSelection(f,d);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};m.TextActions=
b;f.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new l.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:g.trimTrailingWhitespaces});a.setKeyBinding(new l.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:g.toggleLineComment});a.setKeyBinding(new l.KeyBinding(191,!0,!h.isMac,!1,h.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:g.addBlockComment});a.setKeyBinding(new l.KeyBinding(220,!0,!h.isMac,!1,h.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:g.removeBlockComment});a.setKeyBinding(new l.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new l.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new l.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new l.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new l.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new l.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new l.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new l.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new l.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new l.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;var c=a.getSelection();if(c.start===c.end){for(var d=a.getModel(),e=d.getLineAtOffset(c.start),
f=d.getLine(e,!1),h=d.getLineStart(e),g=0,m=c.start-h,k;g<m&&(32===(k=f.charCodeAt(g))||9===k);)g++;var h=f.substring(0,g),b=b.getOptions("tabSize","expandTab"),l=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=d.getLineDelimiter(),C=/^[\s]*\/\*[\*]*[\s]*$/,p=/^[\s]*\*/,w=/\*\/[\s]*$/,r=f.substring(0,m),B=f.substring(m),D;if(this.smartIndentation&&123===f.charCodeAt(D=r.trimRight().length-1))return d=m-D-1,B=B.length-B.trimLeft().length,f=125===f.charCodeAt(m+B)?b+h+l+b+h:b+h+l,a.setText(f,c.start-
d,c.end+B),a.setCaretOffset(c.start+b.length+h.length+l.length-d),!0;if(this.autoCompleteComments&&!w.test(r)&&(C.test(r)||p.test(r))){if(C.exec(r)){f=b+h+" * ";f=w.test(B)?f+B.substring(0,B.length-2).trim():f+B.trim();if(d.getLineCount()===e+1||!p.test(d.getLine(e+1)))f+=b+h+" */";a.setText(f,c.start,c.end+B.length);a.setCaretOffset(c.start+b.length+h.length+3);return!0}if(p.exec(r))for(e-=1;0<=e;e--){g=d.getLine(e,!1);if(C.test(g))return w.test(B)||47===f.charCodeAt(m)?(f=b+h+"*"+B,h=c.start+b.length+
h.length+1):(f=b+h+"* "+B,h=c.start+b.length+h.length+2),a.setText(f,c.start,c.end+B.length),a.setCaretOffset(h),!0;if(!p.test(g))break}}else{if(w.test(r)&&32===h.charCodeAt(h.length-1))return f=b+h.substring(0,h.length-1),a.setText(f,c.start,c.end),a.setCaretOffset(c.start+f.length),!0;if(0<g){for(g=m;g<f.length&&(32===(k=f.charCodeAt(g++))||9===k);)c.end++;a.setText(d.getLineDelimiter()+h,c.start,c.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),c=a.getSelection(),d=this._findEnclosingComment(b,c.start,c.end);if(void 0!==d.commentStart&&void 0!==d.commentEnd)return!0;b=b.getText(c.start,c.end);if(0===b.length)return!0;var d=b.length,b=b.replace(/\/\*|\*\//g,""),e=b.length;a.setText("/*"+b+"*/",c.start,c.end);a.setSelection(c.start+2,c.end+2+(e-d));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel(),f=c.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),h=/^$|[)}\]>]/;return d.start===d.end&&h.test(f)?(c.setText(a+b,d.start,d.start),c.setCaretOffset(d.start+1),!0):d.start!==d.end?(e=e.getText(d.start,d.end),c.setText(a+e+b,d.start,d.end),c.setSelection(d.start+1,d.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel(),e=b.getCaretOffset(),f=0===e?"":d.getText(c.start-1,c.start).trim(),h=e===d.getCharCount()?"":d.getText(c.start,c.start+1).trim(),e=/^"$|^'$/,g=/\w/,m=/^$|[)}\]>]/;if(c.start!==c.end){d=d.getText(c.start,c.end);if(e.test(d))return!1;b.setText(a+d+a,c.start,c.end);b.setSelection(c.start+1,c.end+1)}else{if(h!==a){if(f===a||e.test(h)||g.test(f)||!m.test(h))return!1;b.setText(a+a,c.start,c.start)}b.setCaretOffset(c.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],c=0;c<a.positions.length;++c)b[c]={positions:[{offset:a.positions[c].offset,length:a.positions[c].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&0<a.groups.length&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}):a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);
return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var c=a.getModel(),d=a.getCaretOffset(),e=0===d?"":c.getText(b.start-1,b.start),c=d===c.getCharCount()?"":c.getText(b.start,b.start+1);("("===e&&")"===c||"["===e&&"]"===c||"{"===e&&"}"===c||"\x3c"===e&&"\x3e"===c||'"'===e&&'"'===c||"'"===e&&"'"===c)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,c){var d=a.getLineAtOffset(b),
e=a.getLineAtOffset(c),f,h,g,m,k,l;for(f=d;0<=f&&!(h=a.getLine(f),g=f===d?b-a.getLineStart(d):h.length,m=h.lastIndexOf("/*",g),h=h.lastIndexOf("*/",g),h>m);f--)if(-1!==m){k=a.getLineStart(f)+m;break}for(f=e;f<a.getLineCount()&&!(h=a.getLine(f),g=f===e?c-a.getLineStart(e):0,m=h.indexOf("/*",g),h=h.indexOf("*/",g),-1!==m&&m<h);f++)if(-1!==h){l=a.getLineStart(f)+h;break}return{commentStart:k,commentEnd:l}},lineStart:function(){for(var a=this.editor,b=a.getModel(),c=a.getCaretOffset(),d=b.getLineAtOffset(c),
e=b.getLineStart(d),b=b.getLine(d),d=0;d<b.length;d++){var f=b.charCodeAt(d);if(!(32===f||9===f))break}d+=e;return c!==d?(a.setSelection(d,d),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getText(c.start,c.end),e,f,h;for(h=0;h<d.length;h++)if("/*"===d.substring(h,h+2)){e=c.start+h;break}for(;h<d.length;h++)if("*/"===d.substring(h,h+2)){f=c.start+h;break}if(void 0!==e&&void 0!==f)a.setText(b.getText(e+
2,f),e,f+2),a.setSelection(e,f);else{d=this._findEnclosingComment(b,c.start,c.end);if(void 0===d.commentStart||void 0===d.commentEnd)return!0;b=b.getText(d.commentStart+2,d.commentEnd);a.setText(b,d.commentStart,d.commentEnd+2);a.setSelection(c.start-2,c.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=this.lineComment||"//",c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>d.start?d.end-
1:d.end),h=!0,g=[],m,k,l=e;l<=f;l++)if(m=c.getLine(l,!0),g.push(m),!h||-1===(k=m.indexOf(b)))h=!1;else if(0!==k){var C;for(C=0;C<k;C++){var p=m.charCodeAt(C);if(!(32===p||9===p))break}h=C===k}p=b.length;l=c.getLineStart(e);C=c.getLineEnd(f,!0);if(h){for(h=0;h<g.length;h++)m=g[h],k=m.indexOf(b),g[h]=m.substring(0,k)+m.substring(k+p);b=g.join("");g=c.getLineStart(f);c=l===d.start?d.start:d.start-p;d=d.end-p*(f-e+1)+(d.end===g+1?p:0)}else g.splice(0,0,""),b=g.join(b),c=l===d.start?d.start:d.start+p,
d=d.end+p*(f-e+1);a.setText(b,l,C);a.setSelection(c,d);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),c=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var d=/(\s+$)/,e=b.getLineCount(),f=0;f<e;f++){var h=b.getLine(f),g=d.exec(h);if(g){var m=b.getLineStart(f),h=g[0].length,g=m+g.index;b.setText("",g,g+h);c.start>g&&(c.start=Math.max(g,c.start-h));c.start!==c.end&&c.end>g&&(c.end=Math.max(g,c.end-h))}}a.getUndoStack().endCompoundChange();
a.getTextView().setRedraw(!0);a.setSelection(c.start,c.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel();return(b.getCaretOffset()===d.getCharCount()?"":d.getText(c.start,c.start+1))===a?(b.setCaretOffset(c.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(a){this.autoPairParentheses=
a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};m.SourceCodeActions=f;String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,
"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return m});
define("orion/editor/undoStack",[],function(){function g(e,d,h,b,f){this.model=e;this.offset=d;this.text=h;this.previousText=b;this.type=f}function l(e){this.owner=e;this.changes=[]}function k(e,d){this.size=void 0!==d?d:100;this.reset();var h=this;this._listener={onChanging:function(b){h._onChanging(b)},onDestroy:function(b){h._onDestroy(b)}};if(e.getModel){var b=e.getModel();b.getBaseModel&&(b=b.getBaseModel());this.model=b;this.setView(e)}else this.shared=!0,this.model=e;this.model.addEventListener("Changing",
this._listener.onChanging)}g.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(e,d){this._doUndoRedo(this.offset,this.previousText,this.text,e,d);return!0},redo:function(e,d){this._doUndoRedo(this.offset,this.text,this.previousText,e,d);return!0},merge:function(e,d,h,b,f){if(b===this.type){if(1===b&&e===
this.offset+this.text.length)return this.text+=d,!0;if(-1===b&&f===this.offset)return this.offset=e,this.previousText=h+this.previousText,!0;if(-1===b&&e===this.offset)return this.previousText+=h,!0}return!1},_doUndoRedo:function(e,d,h,b,f){this.model.setText(d,e,e+h.length);f&&b&&(h=b.getModel(),h!==this.model&&(e=h.mapOffset(e,!0)),b.setSelection(e,e+d.length))}};l.prototype={getRedoChanges:function(){for(var e=[],d=0;d<this.changes.length;d++)e=e.concat(this.changes[d].getRedoChanges());return e},
getUndoChanges:function(){for(var e=[],d=this.changes.length-1;0<=d;d--)e=e.concat(this.changes[d].getUndoChanges());return e},add:function(e){this.changes.push(e)},end:function(e){e&&(this.endSelection=e.getSelection(),this.endCaret=e.getCaretOffset());(e=this.owner)&&e.end&&e.end()},undo:function(e,d){1<this.changes.length&&e&&e.setRedraw(!1);for(var h=this.changes.length-1;0<=h;h--)this.changes[h].undo(e,!1);1<this.changes.length&&e&&e.setRedraw(!0);if(d&&e){var h=this.startSelection.start,b=this.startSelection.end;
e.setSelection(this.startCaret?h:b,this.startCaret?b:h)}(h=this.owner)&&h.undo&&h.undo();return 0<this.changes.length},redo:function(e,d){1<this.changes.length&&e&&e.setRedraw(!1);for(var h=0;h<this.changes.length;h++)this.changes[h].redo(e,!1);(1<this.changes.length,e)&&e.setRedraw(!0);if(d&&e){var h=this.endSelection.start,b=this.endSelection.end;e.setSelection(this.endCaret?h:b,this.endCaret?b:h)}(h=this.owner)&&h.redo&&h.redo();return 0<this.changes.length},merge:function(e,d,h,b,f){var c=this.changes.length;
return 0<c?this.changes[c-1].merge(e,d,h,b,f):!1},start:function(e){e&&(this.startSelection=e.getSelection(),this.startCaret=e.getCaretOffset());(e=this.owner)&&e.start&&e.start()}};k.prototype={destroy:function(){this._onDestroy()},add:function(e){this.compoundChange?this.compoundChange.add(e):(this.stack.splice(this.index,this.stack.length-this.index,e),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange=this.stack[this.index-
1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return 0<this.index},canRedo:function(){return 0<this.stack.length-this.index},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var e=[],d=this.index;d<this.stack.length;d++)e=e.concat(this.stack[d].getRedoChanges());
return e},getUndoChanges:function(){this._commitUndo();for(var e=[],d=this.index;0<=d;d--)e=e.concat(this.stack[d].getUndoChanges());return e},undo:function(){this._commitUndo();var e;e=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;e=this.stack[--this.index]}while(!(e=e.undo(this.view,!0)));this._ignoreUndo=!1;return e},redo:function(){this._commitUndo();var e;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;e=this.stack[this.index++]}while(!e.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(e){this.view!==e&&(this.view&&e.removeEventListener("Destroy",this._listener.onDestroy),(this.view=e)&&e.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(e){this._commitUndo();e=new l(e);this.add(e);this.compoundChange=e;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(e){(!e||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(e){if(!this._ignoreUndo){var d=e.text,h=e.start,b=e.addedCharCount,f=e.removedCharCount;e=h+f;var c=0;0===b&&1===f?c=-1:1===b&&0===f&&(c=1);b=this.stack.length;f=this.model.getText(h,e);(!(0<b&&this.index===b)||!this.stack[b-1].merge(h,d,f,c,e))&&this.add(new g(this.model,
h,d,f,c))}}};return{UndoStack:k}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(g,l,k,e){function d(b,a,c,d){this._location=a||"left";this._overview=c||"page";this._rulerStyle=d;this._view=null;var e=this;this._listener={onTextModelChanged:function(a){e._onTextModelChanged(a)},onAnnotationModelChanged:function(a){e._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function h(b,a,c,e,f){d.call(this,b,a,"page",c);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function b(b,a,c){d.call(this,b,a,"page",c)}function f(b,a,c){d.call(this,b,a,"document",c)}function c(c,a,d){b.call(this,c,a,d)}d.prototype={getAnnotations:function(b,a){var c=this._annotationModel;if(!c)return[];var d=this._view.getModel(),e=d.getLineStart(b),f=d.getLineEnd(a-1),h=d;d.getBaseModel&&(h=d.getBaseModel(),e=d.mapOffset(e),f=d.mapOffset(f));for(var g=[],c=this.getAnnotationsByType(c,e,f),e=0;e<
c.length;e++)for(var f=c[e],k=h.getLineAtOffset(f.start),l=h.getLineAtOffset(Math.max(f.start,f.end-1)),z=k;z<=l;z++){var A=z;if(d!==h){A=h.getLineStart(z);A=d.mapOffset(A,!0);if(-1===A)continue;A=d.getLineAtOffset(A)}if(b<=A&&A<a){var C=this._mergeAnnotation(g[A],f,z-k,l-k+1);C&&(g[A]=C)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var p in g)g[p]._multiple&&(g[p].html+=this._multiAnnotationOverlay.html);return g},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay=
b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(b,a){if(void 0!==b){var c=this._view,d=c.getModel(),e=d,f=d.getLineStart(b),h=f,g=f,l=this._annotationModel;if(l){c=c.getSelection();g=d.getLineEnd(b,!0);f<=c.start&&c.start<g&&(f=c.start);d.getBaseModel&&(f=d.mapOffset(f),
g=d.mapOffset(g),e=d.getBaseModel());for(var x,g=l.getAnnotations(f,g),l=null;!x&&g.hasNext();)c=g.next(),this.isAnnotationTypeVisible(c.type)&&(l=c,c.start<=f||(x=c));l&&void 0!==l.groupId&&(this._currentClickGroup=this._currentClickGroup===l.groupId?null:l.groupId,this._setCurrentGroup(b));x&&e.getLineAtOffset(x.start)===e.getLineAtOffset(f)?(f=x.start,g=x.end):g=f=h;d.getBaseModel&&(f=d.mapOffset(f,!0),g=d.mapOffset(g,!0))}(d=k.Tooltip.getTooltip(this._view))&&d.setTarget(null);this._view.setSelection(g,
f,1/3,function(){})}},onDblClick:function(b,a){},onMouseMove:function(b,a){var c=k.Tooltip.getTooltip(this._view);if(c&&!(c.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var d=this;c.setTarget({y:a.clientY,getTooltipInfo:function(){return d._getTooltipInfo(d._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a);this._currentClickGroup||this._setCurrentGroup(b)},onMouseOut:function(b,a){this._currentClickGroup||this._setCurrentGroup(-1);var c=k.Tooltip.getTooltip(this._view);
c&&c.setTarget(null)},_getTooltipInfo:function(b,a){if(void 0!==b){var c=this._view,d=c.getModel(),e=this._annotationModel,f=[];if(e){var f=d.getLineStart(b),h=d.getLineEnd(b);d.getBaseModel&&(f=d.mapOffset(f),h=d.mapOffset(h));f=this.getAnnotationsByType(e,f,h)}e=this._getTooltipContents(b,f);if(!e)return null;e={contents:e,anchor:this.getLocation()};f=c.getClientArea();"document"===this.getOverview()?f.y=c.convert({y:a},"view","document").y:f.y=c.getLocationAtOffset(d.getLineStart(b)).y;c.convert(f,
"document","page");e.x=f.x;e.y=f.y;"right"===e.anchor&&(e.x+=f.width);return e}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(e.isAnnotationTypeVisible(a[b].type)){var f=a[b].start,h=a[b].end;d.getBaseModel&&(f=d.mapOffset(f,!0),h=d.mapOffset(h,!0));-1!==f&&-1!==h&&c.redrawLines(d.getLineAtOffset(f),d.getLineAtOffset(Math.max(f,h-1))+1,e)}}var c=this._view;if(c){var d=c.getModel(),e=this,f=d.getLineCount();b.textModelChangedEvent?
(b=b.textModelChangedEvent.start,d.getBaseModel&&(b=d.mapOffset(b,!0)),b=d.getLineAtOffset(b),c.redrawLines(b,f,e)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,c,d){b||(b={});0===c&&(b.html&&a.html?(a.html!==b.html&&!b._multiple&&this._multiAnnotation&&(b.html=this._multiAnnotation.html),b._multiple=!0):b.html=a.html);b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass=b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?
b.styleClass+(" "+a.styleClass):a.styleClass;var c;if(a.style)for(c in b.style||(b.style={}),a.style)void 0===b.style[c]&&(b.style[c]=a.style[c]);if(a.attributes)for(c in b.attributes||(b.attributes={}),a.attributes)void 0===b.attributes[c]&&(b.attributes[c]=a.attributes[c])}return b},_setCurrentGroup:function(b){var a=this._annotationModel,c=null,d=a.getTextModel(),e,f=this._currentGroupAnnotation;if(-1!==b){var h=d.getLineStart(b),g=d.getLineEnd(b);d.getBaseModel&&(h=d.mapOffset(h),g=d.mapOffset(g));
for(e=a.getAnnotations(h,g);e.hasNext();)if(d=e.next(),this.isAnnotationTypeVisible(d.type)&&d.start<=h&&d.end>=g&&void 0!==d.groupId){c=d;break}if(f&&c&&f.groupId===c.groupId)return}this._currentGroupAnnotation=null;f&&a.removeAnnotations(f.groupType);if(c&&-1!==b){this._currentGroupAnnotation=c;e=a.getAnnotations();for(b=[];e.hasNext();)d=e.next(),delete d.groupAnnotation,d.groupId===c.groupId&&(d=d.createGroupAnnotation(),b.push(d));a.replaceAnnotations(null,b)}}};l.AnnotationTypeList.addMixin(d.prototype);
h.prototype=new d;h.prototype.getAnnotations=function(b,a){for(var c=d.prototype.getAnnotations.call(this,b,a),e=this._view.getModel(),f=b;f<a;f++){var h=f&1?this._oddStyle:this._evenStyle,g=f;e.getBaseModel&&(g=e.getLineStart(g),g=e.getBaseModel().getLineAtOffset(e.mapOffset(g)));c[f]||(c[f]={});c[f].html=this._firstLine+g+"";c[f].style||(c[f].style=h)}return c};h.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};h.prototype.setFirstLine=
function(b){this._firstLine=void 0!==b?b:1};h.prototype._onTextModelChanged=function(b){var a=b.start;b=this._view.getModel();var c=b.getBaseModel?b.getBaseModel().getLineCount():b.getLineCount(),c=(this._firstLine+c-1+"").length;this._numOfDigits!==c&&(this._numOfDigits=c,a=b.getLineAtOffset(a),this._view.redrawLines(a,b.getLineCount(),this))};b.prototype=new d;f.prototype=new d;f.prototype.getRulerStyle=function(){return this._mergeStyle({style:{lineHeight:"1px",fontSize:"1px"}},this._rulerStyle)};
f.prototype._getTooltipContents=function(b,a){if(0===a.length){var c=this._view.getModel(),f=b;c.getBaseModel&&(f=c.getLineStart(f),f=c.getBaseModel().getLineAtOffset(c.mapOffset(f)));return e.formatMessage(g.line,f+1)}return d.prototype._getTooltipContents.call(this,b,a)};f.prototype._mergeAnnotation=function(b,a,c,d){if(0===c)return b||(b={html:"\x26nbsp;",style:{style:{height:3*d+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle)),b};c.prototype=new b;c.prototype.onClick=function(b,a){if(void 0!==
b){var c=this._annotationModel;if(c){var d=this._view.getModel(),e=d.getLineStart(b),f=d.getLineEnd(b,!0);d.getBaseModel&&(e=d.mapOffset(e),f=d.mapOffset(f),d=d.getBaseModel());for(var h,c=c.getAnnotations(e,f);!h&&c.hasNext();)f=c.next(),this.isAnnotationTypeVisible(f.type)&&d.getLineAtOffset(f.start)===d.getLineAtOffset(e)&&(h=f);h&&((d=k.Tooltip.getTooltip(this._view))&&d.setTarget(null),h.expanded?h.collapse():h.expand())}}};c.prototype._getTooltipContents=function(c,a){if(0<a.length){var d=this._view.getModel(),
e=d.getLineStart(c);d.getBaseModel&&(e=d.mapOffset(e),d=d.getBaseModel());for(var e=d.getLineAtOffset(e),f=0;f<a.length;f++){var h=a[f];if(this.isAnnotationTypeVisible(h.type)&&d.getLineAtOffset(h.start)===e){if(a[f].expanded)break;return b.prototype._getTooltipContents.call(this,c,[h])}}}return null};c.prototype._onAnnotationModelChanged=function(c){function a(a){for(h=0;h<a.length;h++)if(f.isAnnotationTypeVisible(a[h].type)){var b=a[h].start;e.getBaseModel&&(b=e.mapOffset(b,!0));-1!==b&&(k=Math.min(k,
e.getLineAtOffset(b)))}}if(c.textModelChangedEvent)b.prototype._onAnnotationModelChanged.call(this,c);else{var d=this._view;if(d){var e=d.getModel(),f=this,h,g=e.getLineCount(),k=g;a(c.added);a(c.removed);a(c.changed);c=d.getRulers();for(h=0;h<c.length;h++)d.redrawLines(k,g,c[h])}}};return{Ruler:d,AnnotationRuler:b,LineNumberRuler:h,OverviewRuler:f,FoldingRuler:c}});
define("orion/editor/textDND",["orion/util"],function(g){function l(g,e){this._view=g;this._undoStack=e;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var d=this;this._listener={onDragStart:function(e){d._onDragStart(e)},onDragEnd:function(e){d._onDragEnd(e)},onDragEnter:function(e){d._onDragEnter(e)},onDragOver:function(e){d._onDragOver(e)},onDrop:function(e){d._onDrop(e)},onDestroy:function(e){d._onDestroy(e)}};g.addEventListener("DragStart",this._listener.onDragStart);g.addEventListener("DragEnd",
this._listener.onDragEnd);g.addEventListener("DragEnter",this._listener.onDragEnter);g.addEventListener("DragOver",this._listener.onDragOver);g.addEventListener("Drop",this._listener.onDrop);g.addEventListener("Destroy",this._listener.onDestroy)}l.prototype={destroy:function(){var g=this._view;g&&(g.removeEventListener("DragStart",this._listener.onDragStart),g.removeEventListener("DragEnd",this._listener.onDragEnd),g.removeEventListener("DragEnter",this._listener.onDragEnter),g.removeEventListener("DragOver",
this._listener.onDragOver),g.removeEventListener("Drop",this._listener.onDrop),g.removeEventListener("Destroy",this._listener.onDestroy),this._view=null)},_onDestroy:function(g){this.destroy()},_onDragStart:function(g){var e=this._view,d=e.getSelection(),e=e.getModel();e.getBaseModel&&(d.start=e.mapOffset(d.start),d.end=e.mapOffset(d.end),e=e.getBaseModel());if(e=e.getText(d.start,d.end))this._dragSelection=d,g.event.dataTransfer.effectAllowed="copyMove",g.event.dataTransfer.setData("Text",e)},_onDragEnd:function(k){if(this._dragSelection){var e=
this._view,d=k.event.dataTransfer.dropEffect;if(!g.isFirefox&&("none"!==d||this._dropText))d=k.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(k="move"===d)&&e.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var d=this._dropText,h=this._dropOffset;k&&(h>=this._dragSelection.end?h-=this._dragSelection.end-this._dragSelection.start:h>=this._dragSelection.start&&(h=this._dragSelection.start));e.setText(d,h,h);e.setSelection(h,
h+d.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(g){this._onDragOver(g)},_onDragOver:function(k){var e=k.event.dataTransfer.types,d=!this._view.getOptions("readonly");d&&e&&(d=e.contains?e.contains("text/plain")||e.contains("Text"):-1!==e.indexOf("text/plain")||-1!==e.indexOf("Text"));d?g.isFirefox||(this._dropEffect=k.event.dataTransfer.dropEffect=(g.isMac?k.event.altKey:k.event.ctrlKey)?"copy":
"move"):k.event.dataTransfer.dropEffect="none"},_onDrop:function(k){var e=this._view,d=k.event.dataTransfer.getData("Text");d&&(g.isFirefox||(k.event.dataTransfer.dropEffect=this._dropEffect),k=e.getOffsetAtLocation(k.x,k.y),this._dragSelection?(this._dropOffset=k,this._dropText=d):(e.setText(d,k,k),e.setSelection(k,k+d.length)))}};return{TextDND:l}});
define("orion/editor/templates",[],function(){function g(g,e,d,h){this.prefix=g;this.description=e;this.template=d;this.name=h;this._parse()}function l(g,e){this._keywords=g||[];this._templates=[];this.addTemplates(e||[])}g.prototype={getProposal:function(g,e,d){g=e-g.length;e={};var h,b=void 0!==d.delimiter?d.delimiter:"\n";d.indentation&&(b+=d.indentation);var f=void 0!==d.tab?d.tab:"\t",c=0,m=this.variables,a=this.segments;d=[];for(var l=0;l<a.length;l++){var q=a[l],s=m[q];if(void 0!==s)switch(q){case "${tab}":q=
f;break;case "${delimiter}":q=b;break;case "${cursor}":q="";h=c;break;default:var t=e[q];t||(t=e[q]={data:s.data,positions:[]});q=s.substitution;t.data&&t.data.values&&(q=t.data.values[0]);t.positions.push({offset:g+c,length:q.length})}d.push(q);c+=q.length}var b=[],y;for(y in e)e.hasOwnProperty(y)&&b.push(e[y]);d=d.join("");void 0===h&&(h=d.length);return{proposal:d,name:this.name,description:this.description,groups:b,escapePosition:g+h,style:"noemphasis"}},match:function(g){return 0===this.prefix.indexOf(g)},
_parse:function(){var g=this.template,e=[],d={},h,b=0,g=g.replace(/\n/g,"${delimiter}"),g=g.replace(/\t/g,"${tab}");g.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(f,c,m){var a=f.substring(2,f.length-1);c=f;var l=a,q=null,s=l.indexOf(":");-1!==s&&(l=l.substring(0,s),c="${"+l+"}",q=JSON.parse(a.substring(s+1).replace("\\}","}").trim()));(a=d[c])||(a=d[c]={});a.substitution=l;q&&(a.data=q);(h=g.substring(b,m))&&e.push(h);e.push(c);b=m+f.length;return l});(h=g.substring(b,g.length))&&e.push(h);this.segments=
e;this.variables=d}};l.prototype={addTemplates:function(k){for(var e=this.getTemplates(),d=0;d<k.length;d++)e.push(new g(k[d].prefix,k[d].description,k[d].template,k[d].name))},computeProposals:function(g,e,d){var h=this.getPrefix(g,e,d),b=[];this.isValid(h,g,e,d)&&(b=b.concat(this.getTemplateProposals(h,e,d)),b=b.concat(this.getKeywordProposals(h)));return b},getKeywords:function(){return this._keywords},getKeywordProposals:function(g){var e=[],d=this.getKeywords();if(d){for(var h=0;h<d.length;h++)0===
d[h].indexOf(g)&&e.push({proposal:d[h].substring(g.length),description:d[h],style:"noemphasis_keyword"});0<e.length&&e.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return e},getPrefix:function(g,e,d){return d.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(g,e,d){for(var h=[],b=this.getTemplates(),f=0;f<b.length;f++){var c=b[f];c.match(g)&&(c=c.getProposal(g,e,d),this.removePrefix(g,c),h.push(c))}0<h.length&&
(h.sort(function(b,a){return b.name<a.name?-1:b.name>a.name?1:0}),h.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return h},removePrefix:function(g,e){if(!(e.overwrite=e.proposal.substring(0,g.length)!==g))e.proposal=e.proposal.substring(g.length)},isValid:function(g,e,d,h){return!0}};return{Template:g,TemplateContentAssist:l}});
define("orion/editor/linkedMode","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/editor/templates orion/objects orion/util".split(" "),function(g,l,k,e,d,h){function b(b,d,a){var e=b.getTextView();k.KeyMode.call(this,e);this.editor=b;this.undoStack=d;this.contentAssist=a;this.linkedModeModel=null;e.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));e.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));e.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));e.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(0<a.selectedGroupIndex?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(a){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),
this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),c=this.linkedModeModel,d,e;c;)if(d=this._getPositionChanged(c,b,b+a.removedCharCount),e=d.position,void 0===e||e.model!==c)this.exitLinkedMode(!1),c=this.linkedModeModel;else break;if(c){c=0;a=a.addedCharCount-a.removedCharCount;d=d.positions;for(var f,h=0;h<d.length;++h){f=d[h];e=f.position;var g=e.offset<=b&&b<=e.offset+e.length;g&&!f.ansestor?(e.offset+=c,
e.length+=a,c+=a):(e.offset+=c,f.ansestor&&g&&(e.length+=a));f.escape&&(f.model.escapePosition=e.offset)}this._updateAnnotations(d)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,c=b.mapOffset(a.start),d=this.editor.mapOffset(a.end),e=this.linkedModeModel,f,h;e;)if(f=this._getPositionChanged(e,c,d),h=f.position,void 0===h||h.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var g=this._compoundChange;g?g.owner.model===e&&g.owner.group===h.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=h.group;var g=0,m=a.text.length-(d-c);f=f.positions;for(var k,c=c-h.position.offset,l=d-h.position.offset,n=0;n<f.length;++n)k=f[n],d=k.position,k.oldOffset=d.offset,k.model===e&&k.group===h.group?(d.offset+=g,d.length+=m,g+=m):(d.offset+=g,k.ansestor&&(d.length+=h.count*m)),k.escape&&(k.model.escapePosition=d.offset);this.ignoreVerify=!0;for(n=f.length-1;0<=n;n--)k=f[n],k.model===e&&k.group===h.group&&b.setText(a.text,k.oldOffset+
c,k.oldOffset+l);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var f={};b.prototype=new k.KeyMode;h.mixin(b.prototype,{createKeyBindings:function(){var b=l.KeyBinding,d=[];d.push({actionID:"linkedModeEnter",keyBinding:new b(13)});d.push({actionID:"linkedModeCancel",keyBinding:new b(27)});d.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});d.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return d},enterLinkedMode:function(b){if(!this.linkedModeModel){var d=
this.editor.getTextView();d.addKeyMode(this);d.addEventListener("Verify",this.linkedModeListener.onVerify);d.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(g.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b);this.linkedModeModel=
b;this.selectLinkedGroup(0)},exitLinkedMode:function(b){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var d=this.linkedModeModel;this.linkedModeModel=d.previousModel;d.parentGroup=d.previousModel=void 0;this.linkedModeModel&&(this.linkedModeModel.nextModel=void 0);if(!this.linkedModeModel){var a=this.editor,e=a.getTextView();e.removeKeyMode(this);e.removeEventListener("Verify",this.linkedModeListener.onVerify);e.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);e=this.contentAssist;e.removeEventListener("Activating",this.linkedModeListener.onActivating);e.offset=void 0;this.editor.reportStatus(g.linkedModeExited,null,!0);b&&a.setCaretOffset(d.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,d=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:d,group:d.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(b){var e=this.linkedModeModel;if(e){e.selectedGroupIndex=b;b=e.groups[b];var a=b.positions[0],f=this.editor;f.setSelection(a.offset,a.offset+a.length);if(e=this.contentAssist)e.offset=void 0,b.data&&"link"===b.data.type&&b.data.values?((this._groupContentAssistProvider=new d.TemplateContentAssist(b.data.values)).getPrefix=function(){var b=
f.getSelection();return b.start===b.end&&(b=f.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?f.getText(a.offset,b):""},e.offset=a.offset,e.deactivate(),e.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,e.deactivate())}this._updateAnnotations()},_getModelPositions:function(b,d,a){for(var e=d.groups,f=0;f<e.length;f++)for(var h=e[f].positions,g=0;g<h.length;g++){var k=h[g];a&&(k={offset:k.offset+a,length:k.length});k={index:g,group:f,count:h.length,model:d,
position:k};b.push(k);d.nextModel&&d.nextModel.parentGroup===f&&(k.ansestor=!0,this._getModelPositions(b,d.nextModel,(a||0)+h[g].offset-h[0].offset))}},_getSortedPositions:function(b){var d=this._sortedPositions;if(!d){for(d=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(d,b);b;)void 0!==b.escapePosition&&d.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;d.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=d}return d},
_getPositionChanged:function(b,d,a){var e;b=this._getSortedPositions(b);for(var f=b.length-1;0<=f;f--){var h=b[f].position;if(h.offset<=d&&a<=h.offset+h.length){e=b[f];break}}return{position:e,positions:b}},_updateAnnotations:function(b){var d=this.editor.getAnnotationModel();if(d){var a=[],f=[];d.getTextModel();for(var h=d.getAnnotations(),g;h.hasNext();)switch(g=h.next(),g.type){case e.AnnotationType.ANNOTATION_LINKED_GROUP:case e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(g)}if(h=
this.linkedModeModel){b=b||this._getSortedPositions(h);for(var k=0;k<b.length;k++)if(g=b[k],g.model===h){var l=e.AnnotationType.ANNOTATION_LINKED_GROUP;g.group===h.selectedGroupIndex&&(l=0===g.index?e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);g=g.position;g=e.AnnotationType.createAnnotation(l,g.offset,g.offset+g.length,"");f.push(g)}}d.replaceAnnotations(a,f)}}});f.LinkedMode=b;return f});
define("orion/editor/factories","orion/editor/actions orion/editor/undoStack orion/editor/rulers orion/editor/annotations orion/editor/textDND orion/editor/linkedMode".split(" "),function(g,l,k,e,d,h){function b(){}function f(){}function c(){}function m(){}function a(){}function n(){}var q={};b.prototype={createKeyBindings:function(a,b,c,d){d=new g.TextActions(a,b,d);var e=new h.LinkedMode(a,b,c);a=new g.SourceCodeActions(a,b,c,e);return{textActions:d,linkedMode:e,sourceCodeActions:a}}};q.KeyBindingsFactory=
b;f.prototype={createUndoStack:function(a){a=a.getTextView();return new l.UndoStack(a,200)}};q.UndoFactory=f;c.prototype={createLineNumberRuler:function(a){return new k.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};q.LineNumberRulerFactory=c;m.prototype={createFoldingRuler:function(a){return new k.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};q.FoldingRulerFactory=m;a.prototype={createAnnotationModel:function(a){return new e.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new e.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new k.AnnotationRuler(a,"left",{styleClass:"ruler annotations"});a=new k.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};q.AnnotationFactory=a;n.prototype={createTextDND:function(a,b){return new d.TextDND(a.getTextView(),b)}};q.TextDNDFactory=n;return q});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(g,l,k,e){return e.mixin({},g,l,k)});define("text!orion/compare/sideBySideTemplate.html",[],function(){return'\x3cdiv id\x3d"topWidget_id" style\x3d"height:100%;width:100%;position:relative"\x3e\n\t\x3cdiv class\x3d"leftPanelLayout "\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"left_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"left_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent" id\x3d"left_editor_id"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"left_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"split compareSplitLayout"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"rightPanelLayout"\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"right_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"right_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent"  id\x3d"right_editor_wrapper_id"\x3e\n\t\t\t\x3cdiv class\x3d"canvasContainer"\x3e\n\t\t\t\t\x3ccanvas id\x3d"diff_canvas_id" class\x3d"compareCanvas" width\x3d"46" height\x3d"3000"\x3e\x3c/canvas\x3e\n\t\t\t\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"compareEditorParentWithCanvas" id\x3d"right_editor_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"right_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/div\x3e'});
define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(g,l,k){var e=e||{};e.TwoWayCompareUIFactory=function(){function d(d){this._parentDivID=d.parentDivID;this._commandSpanId=d.commandSpanId;this._showTitle=d.showTitle;this._leftTitle=d.leftTitle;this._rightTitle=d.rightTitle;this._showLineStatus=d.showLineStatus}d.prototype={_init:function(){var d=this._parentDivID+"_";this._topWidgetDiv=g.node("topWidget_id");
this._topWidgetDiv.id=d+"topWidget_id";this._leftEditorParentDiv=g.node("left_editor_id");this._leftEditorParentDiv.id=d+"left_editor_id";this._rightEditorParentDiv=g.node("right_editor_id");this._rightEditorParentDiv.id=d+"right_editor_id";this._rightEditorWrapperDiv=g.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=d+"right_editor_wrapper_id";this._leftActionDiv=g.node("left_action_id");this._leftActionDiv.id=d+"left_action_id";this._rightActionDiv=g.node("right_action_id");this._rightActionDiv.id=
d+"right_action_id";this._leftTitleDiv=g.node("left_title_id");this._leftTitleDiv.id=d+"left_title_id";this._rightTitleDiv=g.node("right_title_id");this._rightTitleDiv.id=d+"right_title_id";this._leftStatusDiv=g.node("left_status_id");this._leftStatusDiv.id=d+"left_status_id";this._rightStatusDiv=g.node("right_status_id");this._rightStatusDiv.id=d+"right_status_id";this._diffCanvasDiv=g.node("diff_canvas_id");this._diffCanvasDiv.id=d+"diff_canvas_id";this._splitterId=d+"orion_splitter";this._showTitle||
this.disableTitle();this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var d=g.$(".split",this._topWidgetDiv);d.id=this._splitterId;var b=g.$(".leftPanelLayout",this._topWidgetDiv),e=g.$(".rightPanelLayout",this._topWidgetDiv);d&&b&&e&&(this._splitter=new l.Splitter({node:d,sidePanel:b,mainPanel:e}))},buildUI:function(){g.node(this._parentDivID).innerHTML=k;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(d){return g.$(".leftPanelLayout",
this._topWidgetDiv)===d},getEditorParentDiv:function(d){return d?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(d){return d?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(d){return d?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(d){return d?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top=
"0px";this._rightEditorWrapperDiv.style.top="0px";this._leftTitleDiv.style.height="0px";this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px";this._rightEditorWrapperDiv.style.marginBottom="0px";this._leftStatusDiv.style.height="0px";this._rightStatusDiv.style.height="0px"}};return d}();return e});
var JsDiff=function(){function g(b){for(var c=[],d=0;d<b.length;d++)b[d]&&c.push(b[d]);return c}function l(b){b=b.replace(/&/g,"\x26amp;");b=b.replace(/</g,"\x26lt;");b=b.replace(/>/g,"\x26gt;");return b.replace(/"/g,"\x26quot;")}var k=function(b){this.ignoreWhitespace=b};k.prototype={diff:function(b,c){if(c==b)return[{value:c}];if(!c)return[{value:b,removed:!0}];if(!b)return[{value:c,added:!0}];c=this.tokenize(c);b=this.tokenize(b);var d=c.length,a=b.length,e=d+a,h=[{newPos:-1,components:[]}],g=
this.extractCommon(h[0],c,b,0);if(h[0].newPos+1>=d&&g+1>=a)return h[0].components;for(var k=1;k<=e;k++)for(var l=-1*k;l<=k;l+=2){var u;u=h[l-1];var v=h[l+1],g=(v?v.newPos:0)-l;u&&(h[l-1]=void 0);var x=u&&u.newPos+1<d,z=v&&0<=g&&g<a;if(!x&&!z)h[l]=void 0;else{!x||z&&u.newPos<v.newPos?(u={newPos:v.newPos,components:v.components.slice(0)},this.pushComponent(u.components,b[g],void 0,!0)):(u={newPos:u.newPos,components:u.components.slice(0)},u.newPos++,this.pushComponent(u.components,c[u.newPos],!0,void 0));
g=this.extractCommon(u,c,b,l);if(u.newPos+1>=d&&g+1>=a)return u.components;h[l]=u}}},pushComponent:function(b,c,d,a){var e=b[b.length-1];e&&e.added===d&&e.removed===a?b[b.length-1]={value:this.join(e.value,c),added:d,removed:a}:b.push({value:c,added:d,removed:a})},extractCommon:function(b,c,d,a){var e=c.length,h=d.length,g=b.newPos;for(a=g-a;g+1<e&&a+1<h&&this.equals(c[g+1],d[a+1]);)g++,a++,this.pushComponent(b.components,c[g],void 0,void 0);b.newPos=g;return a},equals:function(b,c){var d=/\S/;return this.ignoreWhitespace&&
!d.test(b)&&!d.test(c)?!0:b==c},join:function(b,c){return b+c},tokenize:function(b){return b}};var e=new k,d=new k(!1);d.tokenize=function(b){return g(b.split(/(\s+|\b)/))};var h=new k(!0);h.tokenize=function(b){return g(b.split(/([{}:;,]|\s+)/))};var b=new k;b.tokenize=function(b){return b.split(/^/m)};return{diffChars:function(b,c){return e.diff(b,c)},diffWords:function(b,c){return d.diff(b,c)},diffLines:function(d,c){return b.diff(d,c)},diffCss:function(b,c){return h.diff(b,c)},createPatch:function(d,
c,e,a,h){var g=[];g.push("Index: "+d);g.push("\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d");g.push("--- "+d+"\t"+a);g.push("+++ "+d+"\t"+h);d=b.diff(c,e);d.push({value:"",lines:[]});e=c=0;a=[];for(var k=h=1,l=0;l<d.length;l++){var y=d[l],u=y.lines||y.value.replace(/\n$/,"").split("\n");
y.lines=u;if(y.added||y.removed){if(!c){var v=d[l-1];c=h;e=k;v&&(a.push.apply(a,v.lines.slice(-4).map(function(a){return" "+a})),c-=4,e-=4)}a.push.apply(a,u.map(function(a){return(y.added?"+":"-")+a}));y.added?k+=u.length:h+=u.length}else c&&(8>=u.length&&l<d.length-1?a.push.apply(a,u.map(function(a){return" "+a})):(v=Math.min(u.length,4),g.push("@@ -"+c+","+(h-c+v)+" +"+e+","+(k-e+v)+" @@"),g.push.apply(g,a),g.push.apply(g,u.slice(0,v).map(function(a){return" "+a})),e=c=0,a=[])),h+=u.length,k+=u.length}1<
d.length&&!/\n$/.test(d[d.length-2].value)&&g.push("\\ No newline at end of file\n");return g.join("\n")},convertChangesToXML:function(b){for(var c=[],d=0;d<b.length;d++){var a=b[d];a.added?c.push("\x3cins\x3e"):a.removed&&c.push("\x3cdel\x3e");c.push(l(a.value));a.added?c.push("\x3c/ins\x3e"):a.removed&&c.push("\x3c/del\x3e")}return c.join("")}}}();"undefined"!==typeof module&&(module.exports=JsDiff);"function"===typeof define&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff});
define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(g){var l=l||{};l.JSDiffAdapter=function(){function k(){}k.prototype={_specialLine:function(e,d,h){return d.value===e&&h!==e},adapt:function(e,d,h){h||(h="\n");var b=e.split(h),f=d.split(h),c=""===b[b.length-1],f=""===f[f.length-1],m=g.diffLines(e,d);e=[];d=[];for(var a=0,k=0,l=-1,s=0,t=!0,y=h,u=0;u<m.length;u++){var v=m[u],x=v.lines||v.value.split(h),z=x.length,A=0;1<x.length&&""===x[x.length-1]&&z--;1<z&&!t&&""===x[0]&&(z--,A++);v.lines=
x;if(!v.added&&!v.removed){if(!this._specialLine(h,v,y)){if(a||k)e.push([a,k,l]),k=a=0,l=-1,s+=k;e.push([z,z,0]);s+=z}}else if(v.added){-1===l&&(l=d.length+1);a+=z;for(t=A;t<z+A;t++)d.push(v.lines[t])}else k+=z;t=!1;1<x.length&&""===x[x.length-1]&&(t=!0);y=v.value?v.value[v.value.length-1]:h}if(a||k)e.push([a,k,l]),s+=k;s<b.length&&1<b.length&&(h=e[e.length-1],0===h[2]?(h[0]+=1,h[1]+=1):-1===h[2]?e.push([1,1,0]):c===f?e.push([1,1,0]):(f&&(h[0]+=1),c&&(h[1]+=1)));return{mapper:e,changContents:{array:d,
index:0}}},adaptCharDiff:function(e,d,h){e=h?g.diffWords(e,d):g.diffChars(e,d);d=[];for(var b=h=0,f=0,c=0,m=0;m<e.length;m++){var a=e[m];if(!a.added&&!a.removed){if(0<f||0<c)d.push([b,b+f,h,h+c]),b+=f,h+=c,c=f=0;b+=a.value.length;h+=a.value.length}else a.added?f+=a.value.length:c+=a.value.length}(0<f||0<c)&&d.push([b,b+f,h,h+c]);return d}};return k}();return l});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(g,l,k,e){var d={},h,b,f,c,m,a,n,q,s,t,y,u,v,x,z,A;d.DiffTreeNavigator=function(){function d(a,b,c,e,f,h){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(a,b,c,e,f,h)}h="orion.annotation.diff.addedBlock";b="orion.annotation.diff.currentAddedBlock";f="orion.annotation.diff.deletedBlock";c="orion.annotation.diff.currentDeletedBlock";
m="orion.annotation.diff.blockTop";a="orion.annotation.diff.currentBlockTop";n="orion.annotation.diff.blockConflict";q="orion.annotation.diff.currentBlockConflict";s="orion.annotation.diff.addedWord";t="orion.annotation.diff.currentAddedWord";y="orion.annotation.diff.deletedWord";u="orion.annotation.diff.currentDeletedWord";v="orion.annotation.diff.emptyDeletedWordLeft";x="orion.annotation.diff.emptyDeletedWordRight";z="orion.annotation.diff.emptyAddedWordLeft";A="orion.annotation.diff.emptyAddedWordRight";
k.AnnotationType.registerType(h,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}});k.AnnotationType.registerType(b,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}});k.AnnotationType.registerType(f,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}});k.AnnotationType.registerType(c,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}});k.AnnotationType.registerType(m,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
k.AnnotationType.registerType(a,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});k.AnnotationType.registerType(n,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});k.AnnotationType.registerType(q,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});k.AnnotationType.registerType(s,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});k.AnnotationType.registerType(t,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});k.AnnotationType.registerType(y,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});k.AnnotationType.registerType(u,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});k.AnnotationType.registerType(v,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});k.AnnotationType.registerType(x,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
k.AnnotationType.registerType(z,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});k.AnnotationType.registerType(A,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});d.prototype={initAll:function(a,b,c,d,e,f,h){this._charOrWordDiff=a?a:"word";b&&(this._initialized=!0);this.editorWrapper=[{editor:b,diffFeeder:d},{editor:c,diffFeeder:e}];this._curveRuler=h;(this._overviewRuler=f)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(a){if(a)for(var b=
0;b<this.editorWrapper.length;b++)this.editorWrapper[b].diffFeeder.init(this.editorWrapper[b].editor.getTextView().getModel(),a)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var a;for(a=0;a<this.editorWrapper.length;a++){this.editorWrapper[a].annoTypes=[];this.editorWrapper[a].diffFeeder.getBlockAnnoTypes(this.editorWrapper[a].annoTypes);this.editorWrapper[a].diffFeeder.getWordAnnoTypes(this.editorWrapper[a].annoTypes);for(var b=0;b<this.editorWrapper[a].annoTypes.length;b++)this.editorWrapper[a].annoTypes[b].current&&
this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].current),this.editorWrapper[a].annoTypes[b].normal&&this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].normal)}this._root.children=[];b=this.editorWrapper[0].diffFeeder.getDiffBlocks();if(!b||0===b.length)this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),
this.replaceAllAnnotations(!0,1,"word",!1,[]),this.replaceAllAnnotations(!0,0,"block",!0,[]),this.replaceAllAnnotations(!0,1,"block",!0,[]),this.replaceAllAnnotations(!0,0,"word",!0,[]),this.replaceAllAnnotations(!0,1,"word",!0,[]);else{var c=new e.JSDiffAdapter;for(a=0;a<b.length;a++){var d=this.generatePairBlockAnnotations(this._root,a);this._root.children.push(d);var f=this.generatePairWordAnnotations(d,a,c);f&&(d.children=f)}this.replaceAllAnnotations(!1,0,"block",!0);this.replaceAllAnnotations(!1,
1,"block",!0);this.replaceAllAnnotations(!1,0,"word",!0);this.replaceAllAnnotations(!1,1,"word",!0);this.iterator=new g.TreeModelIterator(this._root.children)}},replaceAllAnnotations:function(a,b,c,d,e){if(this.editorWrapper[b].annoTypes)for(var f=0;f<this.editorWrapper[b].annoTypes.length;f++)this.editorWrapper[b].annoTypes[f].type===c&&this.replaceDiffAnnotations(this.editorWrapper[b].editor,e?e:this.editorWrapper[b].annoTypes[f].list,d?this.editorWrapper[b].annoTypes[f].normal:this.editorWrapper[b].annoTypes[f].current,
a)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(a){return a?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(a,b){this.iterator&&(this.iterator.iterateOnTop(a,b),this.updateCurrentAnnotation(!0))},iterateOnChange:function(a){if(!this.iterator)return null;var b=this.iterator.iterate(a);if(b){var c=this.iterator.cursor();"block"===c.type&&c.children&&0<c.children.length&&this.iterator.iterate(a);this.updateCurrentAnnotation(!0)}return b},
gotoBlock:function(a,b){if(this.iterator){if(0>a||a>=this._root.children.length||0===this._root.children.length)a=0;void 0!==b&&0<=b&&this._root.children[a].children&&b<this._root.children[a].children.length?this.iterator.setCursor(this._root.children[a].children[b]):this.iterator.setCursor(this._root.children[a]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(a,b,c){if(c===this.editorWrapper[a].editor.getTextView()){for(var d=0;d<this._root.children.length;d++){c=
this._root.children[d];var e=0===a?c.oldA:c.newA;if(b>=e.start&&b<=e.end){d=c;if(c.children&&0<c.children.length)for(e=0;e<c.children.length;e++){var f=c.children[e],h=0===a?f.oldA:f.newA;if(b>=h.start&&b<=h.end){d=f;break}}return d}}return null}},gotoChange:function(a,b){for(var c=0;c<this.editorWrapper.length;c++){var d=this._hitDiffAnnotation(c,a,b);if(d)return this.iterator.setCursor(d),this.updateCurrentAnnotation(!1,b),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;
var a=this.iterator.cursor();return!a?-1:"block"===a.type?a.index:a.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var a=this.iterator.cursor();return"block"===a.type?{block:a.index+1}:{block:a.parent.index+1,change:a.index+1}},getCurrentMapperIndex:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();if(!b||0===b.length)return-1;a>b.length-1&&(a=0);return b[a][1]},replaceDiffAnnotations:function(a,b,c,d){if(b&&c&&(a=a.getAnnotationModel())){for(var e=
a.getAnnotations(),f=[];d&&e.hasNext();){var h=e.next();h.type===c&&f.push(h)}a.replaceAnnotations(f,b)}},updateCurrentAnnotation:function(a,b){this.replaceAllAnnotations(!0,0,"block",!1,[]);this.replaceAllAnnotations(!0,1,"block",!1,[]);this.replaceAllAnnotations(!0,0,"word",!1,[]);this.replaceAllAnnotations(!0,1,"word",!1,[]);if(this.iterator){var c=this.iterator.cursor();if(c){var d,e,f={start:c.oldA.start,end:c.oldA.end},h={start:c.newA.start,end:c.newA.end};"word"===c.type?(d=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(f,
this.editorWrapper[0].editor.getTextView().getModel()),e=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(h,this.editorWrapper[1].editor.getTextView().getModel())):(d=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(c.index),e=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(c.index));d&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new (k.AnnotationType.getType(d.current))(f.start,f.end)],d,!0);e&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new (k.AnnotationType.getType(e.current))(h.start,
h.end)],e,!0);a?(this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1):b&&(this.autoSelecting=!0,b!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),b!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1)}}},generatePairBlockAnnotations:function(a,
b){var c=this.generateBlockDiffAnnotations(0,b),d=this.generateBlockDiffAnnotations(1,b);return{parent:a,index:b,type:"block",oldA:c,newA:d}},generatePairWordAnnotations:function(a,b,c){var d=this.editorWrapper[0].diffFeeder.getTextOnBlock(b),e=this.editorWrapper[1].diffFeeder.getTextOnBlock(b),f=0,h=0;if(d&&e&&d.text&&e.text&&5E3>=d.text.length&&5E3>=e.text.length)b=c.adaptCharDiff(d.text,e.text,"word"===this._charOrWordDiff),h=e.start,f=d.start;else return null;c=[];d=[];this.generateWordDiffAnnotations(0,
c,f,b,2,3);this.generateWordDiffAnnotations(1,d,h,b,0,1);b=[];for(f=0;f<c.length;f++)b.push({parent:a,index:f,type:"word",oldA:c[f],newA:d[f]});return b},getAnnoModelList:function(a,b,c){for(var d=0;d<this.editorWrapper[a].annoTypes.length;d++)if(this.editorWrapper[a].annoTypes[d].type===b&&this.editorWrapper[a].annoTypes[d].normal===c)return this.editorWrapper[a].annoTypes[d].list;return null},generateBlockDiffAnnotations:function(a,b){var c=this.editorWrapper[a].diffFeeder.getCurrentBlockAnnoType(b),
d=this.getAnnoModelList(a,"block",c.normal),e=this.editorWrapper[a].diffFeeder.getCharRange(b),c=k.AnnotationType.createAnnotation(c.normal,e.start,e.end);d&&d.push(c);return c},generateWordDiffAnnotations:function(a,b,c,d,e,f){if(d){var h=this.editorWrapper[a].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1});a=this.getAnnoModelList(a,"word",h.normal);for(var g=0;g<d.length;g++){var m=k.AnnotationType.createAnnotation(h.normal,d[g][e]+c,d[g][f]+c);a.push(m);b.push(m)}}},_updateOverviewRuler:function(){if(this._overviewRuler){var a=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(a,a+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(a,b){var c=a.getLineHeight(),d=a.getClientArea(),c=Math.floor(d.height/c/3);a.setTopIndex(0<b-c?b-c:0)},_positionDiffBlock:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();0!==b.length&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
b[a][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(a=l.lookUpLineIndex(this.getMapper(),0,b[a][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),a)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(a){this._initialized&&(a=0>a?0:l.getAnnotationIndex(this.getFeeder().getDiffBlocks(),a),this.gotoBlock(a))},gotoDiff:function(a,b){this.gotoChange(a,b)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,
!0);this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0);this._positionDiffBlock()},nextChange:function(){var a=this.iterateOnChange(!0);this._positionDiffBlock();return a},prevChange:function(){this.iterateOnChange(!1);this._positionDiffBlock()}};return d}();d.DiffBlockFeeder=function(){function a(){}a.prototype={_isAddedSide:function(){return 0===this._mapperColumnIndex},getWordAnnoTypes:function(a){this._isAddedSide()?a.push({type:"word",current:t,normal:s,list:[]}):a.push({type:"word",
current:u,normal:y,list:[]});a.push({type:"word",current:v});a.push({type:"word",current:x});a.push({type:"word",current:z});a.push({type:"word",current:A})},getCurrentWordAnnoType:function(a,b){return a.start===a.end&&b?this._isAddedSide()?{current:this._repositionEmptyWord(a,b),normal:s}:{current:this._repositionEmptyWord(a,b),normal:y}:this._isAddedSide()?{current:t,normal:s}:{current:u,normal:y}},_repositionEmptyWord:function(a,b){var c=b.getLineAtOffset(a.start),d=b.getLineStart(c),e=b.getLineEnd(c);
if(d!==e){if(a.start===e)return a.start--,this._isAddedSide()?A:x;a.end++}else if(0<c&&(c--,d=b.getLineStart(c),e=b.getLineEnd(c),d!==e))return a.start=e-1,a.end=e,this._isAddedSide()?A:x;return this._isAddedSide()?z:v},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return-1===a?0:this._mapper[a][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(a){return a},getCharRange:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var b=this._diffBlocks[a][0],c=b+this._mapper[this._diffBlocks[a][1]][this._mapperColumnIndex]-1;a=this._textModel.getLineStart(b);if(c<b)return{start:a,end:a};b=this._textModel.getLineEnd(c,!0);return{start:a,end:b}},getTextOnBlock:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;a=this.getCharRange(a);return{start:a.start,text:this._textModel.getText(a.start,
a.end)}},isMapperEmpty:function(){return 0===this._mapper.length}};return a}();d.TwoWayDiffBlockFeeder=function(){function e(a,b,c,d){this._mapperColumnIndex=c;this._reverseAnnotation=d;this.init(a,b)}e.prototype=new d.DiffBlockFeeder;e.prototype._isAddedSide=function(){return this._reverseAnnotation?0!==this._mapperColumnIndex:0===this._mapperColumnIndex};e.prototype.init=function(a,b){this._textModel=a;this._diffBlocks=void 0;if(b){this._mapper=b;this._diffBlocks=[];for(var c=0,d=0;d<this._mapper.length;d++)0!==
this._mapper[d][2]&&this._diffBlocks.push([c,d]),c+=this._mapper[d][this._mapperColumnIndex]}};e.prototype.getBlockAnnoTypes=function(d){this._isAddedSide()?d.push({type:"block",normal:h,current:b,list:[]}):d.push({type:"block",normal:f,current:c,list:[]});d.push({type:"block",normal:m,current:a,list:[]});d.push({type:"block",normal:n,current:q,list:[]})};e.prototype.getCurrentBlockAnnoType=function(d){if(!this._diffBlocks||0===this._diffBlocks.length||this._diffBlocks.length<=d)return null;d=this._diffBlocks[d][1];
return 0===this._mapper[d][this._mapperColumnIndex]?{normal:m,current:a}:l.isMapperConflict(this.getMapper(),d)?{normal:n,current:q}:this._isAddedSide()?{type:"block",normal:h,current:b,list:[]}:{type:"block",normal:f,current:c,list:[]}};return e}();d.inlineDiffBlockFeeder=function(){function a(b,c){this._mapperColumnIndex=c;this.init(b)}a.prototype=new d.DiffBlockFeeder;a.prototype.setModel=function(a){this._textModel=a};a.prototype.init=function(a){this._diffBlocks=void 0;if(a){this._mapper=a;this._diffBlocks=
[];this._gapBlocks=[];for(var b=a=0,c=0;c<this._mapper.length;c++){if(0!==this._mapper[c][2]){if(this._isAddedSide()){var d=a+this._mapper[c][1];this._diffBlocks.push([d,c]);this._gapBlocks.push([d,d+this._mapper[c][0],b])}else this._diffBlocks.push([a,c]),this._gapBlocks.push([a,a+this._mapper[c][1],b]);a+=this._mapper[c][0]+this._mapper[c][1]}else this._gapBlocks.push([a,a+this._mapper[c][this._mapperColumnIndex],b]),a+=this._mapper[c][this._mapperColumnIndex];b+=this._mapper[c][this._mapperColumnIndex]}}};
a.prototype.getBlockAnnoTypes=function(a){this._isAddedSide()?a.push({type:"block",normal:h,current:b,list:[]}):a.push({type:"block",normal:f,current:c,list:[]});a.push({type:"block",normal:n,current:q,list:[]})};a.prototype.getCurrentBlockAnnoType=function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;a=this._diffBlocks[a][1];return 0===this._mapper[a][this._mapperColumnIndex]?{current:t,normal:s}:l.isMapperConflict(this.getMapper(),a)?{normal:n,current:q}:this._isAddedSide()?
{type:"block",normal:h,current:b,list:[]}:{type:"block",normal:f,current:c,list:[]}};a.prototype.getDiffBlockH=function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return this._mapper[a][0]+this._mapper[a][1]};a.prototype.getLineNumber=function(a){for(var b=0;b<this._gapBlocks.length;b++)if(this._gapBlocks[b][0]!==this._gapBlocks[b][1]&&a>=this._gapBlocks[b][0]&&a<this._gapBlocks[b][1])return a-this._gapBlocks[b][0]+this._gapBlocks[b][2];return-1};return a}();
return d});
define("orion/compare/compareView","i18n!orion/compare/nls/messages orion/Deferred orion/webui/littlelib orion/compare/diffParser orion/compare/compareRulers orion/editor/editor orion/editor/editorFeatures orion/keyBinding orion/editor/textView orion/compare/compareUIFactory orion/compare/compareUtils orion/compare/jsdiffAdapter orion/compare/diffTreeNavigator".split(" "),function(g,l,k,e,d,h,b,f,c,m,a,n,q,s,t,y){var u={};u.CompareView=function(){function a(){this._diffParser=new e.DiffParser}a.prototype=
{_clearOptions:function(){this.options={};this.options.blockNumber=1;this.options.changeNumber=0},_getLineDelim:function(a,b){return"\n"},_generateMapper:function(a,b,c,d,e){var f=this._getLineDelim(a,c);this._diffParser.setLineDelim(f);if(this.options.mapper&&this.options.toggler)return{delim:f,mapper:this.options.mapper,output:this.options.newFile.Content,diffArray:this.options.diffArray};if("string"===typeof b&&"string"===typeof a)return a=(new n.JSDiffAdapter).adapt(a,b,f),this.options.toggler&&
(this.options.mapper=a.mapper,this.options.newFile.Content=b,this.options.diffArray=a.changContents),{delim:f,mapper:a.mapper,output:b,diffArray:a.changContents};b=this._diffParser.parse(a,c,d,e);a=this._diffParser.getDiffArray();this.options.toggler&&(this.options.mapper=b.mapper,this.options.newFile.Content=b.outPutFile,this.options.diffArray=a);return{delim:f,mapper:b.mapper,output:b.outPutFile,diffArray:a}},_loadImageFile:function(a,b,c){var d=document.createElement("img");d.src=a;var e=new l;
d.onload=function(){b.appendChild(d);if(c){var a=document.createElement("hr");b.appendChild(a)}e.resolve(d.height)};d.onerror=function(){e.resolve(0)};return e},_initSyntaxHighlighter:function(a){this._syntaxHighlighters=null;if(this.options.highlighters&&0<this.options.highlighters.length&&!(1>a.length||2<a.length))this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:a[0]}],2===a.length&&2===this.options.highlighters.length&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],
target:a[1]})},_highlightSyntax:function(){if(this._syntaxHighlighters){var a=[];this._syntaxHighlighters.forEach(function(b){a.push(b.highlighter.highlight(b.target.fileName,b.target.contentType,b.target.editor))}.bind(this));l.all(a,function(a){return{_error:a}}).then(function(a){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-
1,this.options.changeNumber-1)}.bind(this),50)},setOptions:function(a,b){b&&this._clearOptions();this.options||(this.options={});a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this));if(a.newFileOnRight){var c=this.options.newFile;this.options.newFile=this.options.oldFile;this.options.oldFile=c}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},
prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors();this.refresh(!0)},initEditors:function(a){},initImageMode:function(){}};return a}();u.TwoWayCompareView=function(){function a(b){this.setOptions(b,!0);this._diffNavigator=new q.DiffTreeNavigator("word");this.type="twoWay";(this._uiFactory=this.options.uiFactory)||
(this._uiFactory=new m.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI());this._viewLoadedCounter=0;this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._curveRuler=new d.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}a.prototype=new u.CompareView;a.prototype.initEditors=function(a){this._editors=
[];this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile));this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0));this._overviewRuler=new d.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));window.onbeforeunload=function(){if(this._editors&&this._editors.some(function(a){return a.isDirty()}))return g["There are unsaved changes."]}.bind(this)};
a.prototype.initImageMode=function(){this._editors&&(this._editors.forEach(function(a){a.destroy()}),this._editors=null);this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode");this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode");this._uiFactory.disableTitle();this._uiFactory.disableLineStatus();this._imageMode=!0};a.prototype.getImageMode=function(){return this._imageMode};a.prototype.getEditors=function(){return this._editors};a.prototype.gotoDiff=
function(a,b,c){c=c?this._editors[1].getTextView():this._editors[0].getTextView();a=c.getModel().getLineStart(a)+b;this._diffNavigator.gotoDiff(a,c)};a.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)};a.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)};a.prototype.resizeEditors=function(){this._editors.forEach(function(a){a.getTextView().resize()})};a.prototype.getSplitter=function(){return this._uiFactory.getSplitter()};a.prototype._createEditor=function(a,d,e,f,m){var k=
"undefined"===typeof f.readonly?!0:f.readonly,l=function(){var a=new c.TextView({parent:d,readonly:k,tabSize:4});this._viewLoadedCounter++;2===this._viewLoadedCounter&&this._diffNavigator.matchPositionFromOverview(-1);if(this.onLoad)this.onLoad();var b=this.getSplitter();b&&b.addResizeListener(function(b){b&&(this._uiFactory.isLeftPane(b)?m:!m)&&a.resize()}.bind(this));return a}.bind(this),n=f.keyBindingFactory;n||(n=new b.KeyBindingsFactory);var q=null;if(e)var s="",q=function(a,b){e&&(s=b?g["ERROR: "]+
a:a,e.textContent=""+s)};l=new h.Editor({textViewFactory:l,undoStackFactory:new b.UndoFactory,annotationFactory:new b.AnnotationFactory,keyBindingFactory:n,statusReporter:q,domNode:d});l.installTextView();l.setInput(null,null,f.Content?f.Content:a);l.setOverviewRulerVisible(!1);var F=l.getTextView();F.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&(a=F.getCaretOffset(),
this._diffNavigator.gotoDiff(a,F))}.bind(this));F.getModel().addEventListener("Changed",function(a){this._curveRuler.onChanged(a,!m)||(this.options.mapper=null)}.bind(this));m?F.addEventListener("Scroll",function(a){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render());if(this.onScroll)this.onScroll()}.bind(this)):F.addEventListener("Scroll",function(a){this._curveRuler&&this._curveRuler.render()}.bind(this));return l};a.prototype.destroy=function(){this._editors&&(this._diffNavigator.destroy(),
this._editors.forEach(function(a){a.destroy()}),this._uiFactory.destroy())};a.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var a=new d.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),b=new d.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(a);this._editors[0].getTextView().addRuler(b);
this._editors[0].getTextView().addRuler(this._overviewRuler);this._hasRuler=!0}};a.prototype.refresh=function(a){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(a){return b._loadImageFile(b.options.oldFile.URL,b._uiFactory.getEditorParentDiv()).then(function(b){return(new l).resolve(a>b?a:b)})})}var c=this.options.oldFile.Content,
d=this.options.newFile.Content,e=this.options.diffContent;"string"===typeof d?e=this._generateMapper(c,d,e,this.options.hasConflicts):(e=this._generateMapper(c,d,e,this.options.hasConflicts),d=e.output);var f=new q.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),e.mapper,1,this.options.newFileOnRight),h=new q.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),e.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editors[0],
this._editors[1],f,h,this._overviewRuler,this._curveRuler);this._curveRuler.init(e.mapper,this._editors[1],this._editors[0],this._diffNavigator);a&&(this._editors[1].setInput(this.options.newFile.Name,null,d),this._editors[0].setInput(this.options.oldFile.Name,null,c));this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editors[0]}]);this._highlightSyntax();
this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();2===this._viewLoadedCounter&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);this.refreshTitle(0);this.refreshTitle(1);a=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5;c=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+5;return a>c?a:c};a.prototype.refreshTitle=
function(a,b){if(1===a){var c=this._uiFactory.getTitleDiv(!0);c&&(k.empty(c),c.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.newFile.Name+"*":this.options.newFile.Name)))}else if(c=this._uiFactory.getTitleDiv(!1))k.empty(c),c.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.oldFile.Name+"*":this.options.oldFile.Name))};return a}();u.InlineCompareView=function(){function e(a){this.setOptions(a,!0);this._diffNavigator=new q.DiffTreeNavigator("word");
this.type="inline";this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._editorDiv=this.options.parentDivId}e.prototype=new u.CompareView;e.prototype.addRulers=function(){this._textView&&!this._hasRuler&&(this._textView.addRuler(this._rulerOrigin),this._textView.addRuler(this._rulerNew),this._textView.addRuler(this._overviewRuler),this._hasRuler=!0)};e.prototype.removeRulers=function(){this._textView&&this._hasRuler&&(this._textView.removeRuler(this._rulerOrigin),this._textView.removeRuler(this._rulerNew),
this._textView.removeRuler(this._overviewRuler),this._hasRuler=!1)};e.prototype.destroyEditor=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.setText(""),this.removeRulers())};e.prototype.destroy=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.destroy())};e.prototype.initEditors=function(a){var e=k.node(this._editorDiv),f=function(){return new c.TextView({parent:e,readonly:!0,tabSize:4})}.bind(this);this._editor=new h.Editor({textViewFactory:f,undoStackFactory:new b.UndoFactory,
annotationFactory:new b.AnnotationFactory,domNode:e});this._editor.installTextView();this._editor.setInput(null,null,a);this._editor.setOverviewRulerVisible(!1);this._editor.setAnnotationRulerVisible(!1);this._textView=this._editor.getTextView();this._rulerOrigin=new d.LineNumberCompareRuler(this._diffNavigator,1,"left",{styleClass:"ruler lines inlineRulerLeft"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._rulerNew=new d.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},
{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._overviewRuler=new d.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));this._textView.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&(a=this._textView.getCaretOffset(),this._diffNavigator.gotoDiff(a,this._textView))}.bind(this))};
e.prototype.initImageMode=function(){this._editor&&(this._editor.destroy(),this._editor=null);k.node(this._editorDiv).classList.add("compareEditorParentImageMode");this._imageMode=!0};e.prototype.getImageMode=function(){return this._imageMode};e.prototype._initDiffPosition=function(a){var b=a.getModel();if(b&&b.getAnnotations&&(b=b.getAnnotations(),0<b.length)){var b=b[0][0],c=a.getLineHeight(),d=a.getClientArea(),c=Math.floor(d.height/c/3);a.setTopIndex(0<b-c?b-c:0)}};e.prototype.refresh=function(){if(this._imageMode){this.options.commandProvider&&
this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,k.node(this._editorDiv),!0).then(function(a){return b._loadImageFile(b.options.oldFile.URL,k.node(b._editorDiv)).then(function(b){return(new l).resolve(a+b+20)})})}var c=this.options.oldFile.Content,d=this.options.newFile.Content,e=this._generateMapper(c,d,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);"string"!==typeof d&&(d=e.output);this._textView.getModel().setText(c);
c=new q.inlineDiffBlockFeeder(e.mapper,1);d=new q.inlineDiffBlockFeeder(e.mapper,0);a.mergeDiffBlocks(this._textView.getModel(),d.getDiffBlocks(),e.mapper,e.diffArray.array,e.diffArray.index,this._diffParser._lineDelimiter);c.setModel(this._textView.getModel());d.setModel(this._textView.getModel());this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,c,d,this._overviewRuler);this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,
editor:this._editor}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();e=this._textView.getTopIndex();this._textView.redrawLines(e,e+1,this._overviewRuler);this._textView.redrawLines(e,e+1,this._rulerOrigin);this._textView.redrawLines(e,e+1,this._rulerNew);this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5};e.prototype.setConflicting=
function(a){this._conflcit=a};return e}();u.toggleableCompareView=function(){function a(b,c){c&&(c.toggler=this);this._widget="inline"===b?new u.InlineCompareView(c):new u.TwoWayCompareView(c)}a.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0;this._widget.initImageMode()},toggle:function(){var a=this._widget.options;if(!this._imageMode){var b=this._widget.getCurrentDiffPos();a.blockNumber=b.block;a.changeNumber=b.change}this._widget.destroy();k.empty(k.node(a.parentDivId));
this._widget="inline"===this._widget.type?new u.TwoWayCompareView(a):new u.InlineCompareView(a);this._imageMode?this._widget.initImageMode():this._widget.initEditors();this._widget.refresh(!0)},getWidget:function(){return this._widget}};return a}();return u});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},
number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(g){var l="break case class catch continue const debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof undefined var void while with yield".split(" ");g=g.grammars;g.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",
end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},
{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+l.join("|")+")\\b",name:"keyword.control.js"}]});return{id:g[g.length-1].id,grammars:g,keywords:l}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(g){var l="abstract boolean break byte case catch char class continue default do double else extends false final finally float for if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try void volatile while".split(" ");g=g.grammars;g.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+
l.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:g[g.length-1].id,grammars:g,keywords:l}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(g){var l="alignment-adjust alignment-baseline animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth backface-visibility background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size background baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-bottom border-collapse border-color border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-image border-left-color border-left-style border-left-width border-left border-radius border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-top border-width border bottom box-align box-decoration-break box-direction box-flex-group box-flex box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before break-inside caption-side clear clip color-profile color column-count column-fill column-gap column-rule-color column-rule-style column-rule-width column-rule column-span column-width columns content counter-increment counter-reset crop cue-after cue-before cue cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit-position fit flex-align flex-flow flex-inline-pack flex-order flex-pack float-offset float font-family font-size font-size-adjust font-stretch font-style font-variant font-weight font grid-columns grid-rows hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens icon image-orientation image-rendering image-resolution inline-box-align left letter-spacing line-height line-stacking-ruby line-stacking-shift line-stacking-strategy line-stacking list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top margin mark-after mark-before mark marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity orphans outline-color outline-offset outline-style outline-width outline overflow-style overflow-x overflow-y overflow padding-bottom padding-left padding-right padding-top padding page-break-after page-break-before page-break-inside page-policy page pause-after pause-before pause perspective-origin perspective phonemes pitch-range pitch play-during position presentation-level punctuation-trim quotes rendering-intent resize rest-after rest-before rest richness right rotation-point rotation ruby-align ruby-overhang ruby-position ruby-span size speak-header speak-numeral speak-punctuation speak speech-rate stress string-set table-layout target-name target-new target-position target text-align-last text-align text-decoration text-emphasis text-height text-indent text-justify text-outline text-shadow text-transform text-wrap top transform-origin transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch-range voice-pitch voice-rate voice-stress voice-volume volume white-space-collapse white-space widows width word-break word-spacing word-wrap z-index".split(" ");g=
g.grammars;g.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},
{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+l.join("|")+")\\b",name:"keyword.control.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});
return{id:g[g.length-1].id,grammars:g,keywords:l}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(g,l,k,e){function d(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function h(){d.call(this,null,!0)}function b(a){d.call(this,null,a)}function f(){d.call(this,null,!1)}function c(c,e,g){this.commentStart="/*";this.commentEnd="*/";var k=[];switch(e){case "java":k=a;break;
case "js":k=m;break;case "css":k=n}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new d(k,this.whitespacesVisible);this._firstScanner=new f;this._commentScanner=new b(this.whitespacesVisible);this._whitespaceScanner=new h;"css"===e&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=c;this.annotationModel=g;this._bracketAnnotations=void 0;var l=this;this._listener=
{onChanged:function(a){l._onModelChanged(a)},onDestroy:function(a){l._onDestroy(a)},onLineStyle:function(a){l._onLineStyle(a)},onMouseDown:function(a){l._onMouseDown(a)},onSelection:function(a){l._onSelection(a)}};e=c.getModel();e.getBaseModel&&(e=e.getBaseModel());e.addEventListener("Changed",this._listener.onChanged);c.addEventListener("MouseDown",this._listener.onMouseDown);c.addEventListener("Selection",this._listener.onSelection);c.addEventListener("Destroy",this._listener.onDestroy);c.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();c.redrawLines()}var m=l.keywords,a=k.keywords,n=e.keywords,q={styleClass:"comment"},s={styleClass:"comment"},t={styleClass:"comment block documentation"},y={styleClass:"keyword other documentation markup"},u={styleClass:"keyword other documentation task"},v={styleClass:"keyword other documentation tag"},x={styleClass:"string"},z={styleClass:"constant numeric"},A={styleClass:"keyword"},C={styleClass:"punctuation separator space",
unmergeable:!0},p={styleClass:"punctuation separator tab",unmergeable:!0},w={styleClass:"meta annotation currentLine"};d.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,c=this.offset-1;if(!b&&48<=a&&57>=a){var d=b=!1,e=!1,f=a;do if(a=this._read(),46===a&&!b)b=!0;else if(101===a&&!d)b=d=!0,a=this._read(),45!==a&&this._unread(a);else if(120===a&&48===f&&2===this.offset-c)b=d=e=!0;else if(!(48<=a&&57>=a||e&&(65<=a&&70>=a||97<=a&&102>=a)))break;while(1);this._unread(a);return 3}if(97<=a&&122>=a||65<=a&&90>=a||95===a||45===a&&b){do a=this._read();while(97<=a&&
122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a||45===a&&b);this._unread(a);a=this.keywords;if(0<a.length){c=this.text.substring(c,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===c)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){-1!==a&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&47===a)for(;;)if(a=
this._read(),-1===a||10===a||13===a)return this._unread(a),6;if(42===a){a=this._read();b=7;for(42===a&&(b=8);;){for(;42===a;)if(a=this._read(),47===a)return b;if(-1===a)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};h.prototype=new d(null);h.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(32===a||9===a||-1===a));this._unread(a);
return 1}}};b.prototype=new d(null);b.prototype.setType=function(a){this._type=a};b.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);return 9;case 60:if(8===this._type){do a=this._read();while(!(62===a||-1===a));if(62===a)return 12}return 1;case 64:if(8===this._type){do a=this._read();while(97<=a&&122>=a||65<=a&&90>=
a||95===a||48<=a&&57>=a);this._unread(a);return 13}return 1;case 84:if(79===(a=this._read()))if(68===(a=this._read()))if(79===(a=this._read()))if(a=this._read(),!(97<=a&&122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(32===a||9===a||-1===a||60===a||64===a||84===a));this._unread(a);return 1}}};f.prototype=new d(null);f.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};c.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;void 0===d&&(d=-1);for(void 0===e&&(e=a.length);1<e-d;)if(f=Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=f;break}else d=f;return e},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(g.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var h=e[f];(h=this._createFoldingAnnotation(a,d,h.start,h.end))&&c.push(h)}b.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c);b=b.getLineAtOffset(d);return e===b?null:new (g.AnnotationType.getType(g.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_computeTasks:function(a,b,c){if(this.detectTasks){var d=
this.annotationModel;if(d){var e=this.view.getModel(),f=e;e.getBaseModel&&(f=e.getBaseModel());for(var h=d.getAnnotations(b,c),e=[],m=g.AnnotationType.ANNOTATION_TASK;h.hasNext();){var k=h.next();k.type===m&&e.push(k)}h=[];k=this._commentScanner;k.setText(f.getText(b,c));for(var l;l=k.nextToken();){var n=k.getStartOffset()+b;14===l&&(l=f.getLineEnd(f.getLineAtOffset(n)),6!==a&&(l=Math.min(l,c-this.commentEnd.length)),h.push(g.AnnotationType.createAnnotation(m,n,l,f.getText(n,l))))}d.replaceAnnotations(e,
h)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===a)return w}return null},_getStyles:function(a,b,c){a.getBaseModel&&(c=a.mapOffset(c));for(var d=c+b.length,e=[],f=c,h=this.comments,g=this._binarySearch(h,c,!0);g<h.length&&!(h[g].start>=d);g++){var m=h[g].start,k=h[g].end;f<m&&this._parse(b.substring(f-c,m-c),f,e);var l=h[g].type,n;switch(l){case 8:n=t;break;case 7:n=s;break;case 5:n=x}f=Math.max(f,
m);m=Math.min(d,k);(8===l||7===l)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,m-c),f,e,n,l):5===l&&this.whitespacesVisible?this._parseString(b.substring(f-c,m-c),f,e,x):e.push({start:f,end:m,style:n});f=k}f<d&&this._parse(b.substring(f-c,d-c),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)c=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+c;return e},_parse:function(a,b,c){var d=this._scanner;for(d.setText(a);a=d.nextToken();){var e=
d.getStartOffset()+b,f=null;switch(a){case 2:f=A;break;case 3:f=z;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,x);continue}else f=x;break;case 8:this._parseComment(d.getData(),e,c,t,a);continue;case 6:this._parseComment(d.getData(),e,c,q,a);continue;case 7:this._parseComment(d.getData(),e,c,s,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=C)}c.push({start:e,end:d.getOffset()+b,
style:f})}},_parseComment:function(a,b,c,d,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){e=f.getStartOffset()+b;var h=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=C);break;case 12:h=y;break;case 13:h=v;break;case 14:h=u;break;default:this.detectHyperlinks&&(h=this._detectHyperlinks(f.getData(),e,c,h))}h&&c.push({start:e,end:f.getOffset()+b,style:h})}},_parseString:function(a,b,c,d){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=C)}h&&c.push({start:f,end:e.getOffset()+b,style:h})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if(0<(f=a.indexOf("://"))){for(var e=a,h=f;0<h;){f=e.charCodeAt(h-1);if(!(97<=f&&122>=f||65<=f&&90>=f||45===f||48<=f&&57>=f))break;h--}if(0<h&&(f="\"\"''(){}[]\x3c\x3e".indexOf(e.substring(h-
1,h)),-1!==f&&0===(f&1)&&-1!==(f=e.lastIndexOf("\"\"''(){}[]\x3c\x3e".substring(f+1,f+2))))){var g=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(h,g)};c.push({start:b,end:b+h,style:d});c.push({start:b+h,end:b+g,style:f});c.push({start:b+g,end:b+a.length,style:d});return null}}else 0===a.toLowerCase().indexOf("bug#")&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id\x3d"+parseInt(a.substring(4),10));return e?(f=this._clone(d),f.tagName="a",f.attributes={href:e},f):d},_clone:function(a){if(!a)return a;
var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_findComments:function(a,b){b=b||0;var c=this._firstScanner,d;c.setText(a);for(var e=[];d=c.nextToken();)(7===d||8===d||5===d)&&e.push({start:c.getStartOffset()+b,end:c.getOffset()+b,type:d}),(6===d||7===d||8===d)&&this._computeTasks(d,c.getStartOffset()+b,c.getOffset()+b);return e},_findMatchingBracket:function(a,b){var c="{}()[]\x3c\x3e",d=a.getText(b,b+1),e=c.indexOf(d,0);if(-1===e)return-1;var f;f=e&1?c.substring(e-1,e):c.substring(e+
1,e+2);for(var h=a.getLineAtOffset(b),c=a.getLine(h),g=a.getLineStart(h),m=a.getLineEnd(h),c=this._findBrackets(d,f,c,g,g,m),m=0;m<c.length;m++)if(g=0<=c[m]?1:-1,c[m]*g-1===b){var k=1;if(e&1){for(m--;0<=m;m--)if(g=0<=c[m]?1:-1,k+=g,0===k)return c[m]*g-1;for(h-=1;0<=h;){c=a.getLine(h);g=a.getLineStart(h);m=a.getLineEnd(h);c=this._findBrackets(d,f,c,g,g,m);for(e=c.length-1;0<=e;e--)if(g=0<=c[e]?1:-1,k+=g,0===k)return c[e]*g-1;h--}}else{for(m++;m<c.length;m++)if(g=0<=c[m]?1:-1,k+=g,0===k)return c[m]*
g-1;h+=1;for(e=a.getLineCount();h<e;){c=a.getLine(h);g=a.getLineStart(h);m=a.getLineEnd(h);c=this._findBrackets(d,f,c,g,g,m);for(m=0;m<c.length;m++)if(g=0<=c[m]?1:-1,k+=g,0===k)return c[m]*g-1;h++}}break}return-1},_findBrackets:function(a,b,c,d,e,f){var h=[];a=a.charCodeAt(0);b=b.charCodeAt(0);for(var g=e,m=this._scanner,k,l=this.comments,n=this._binarySearch(l,e,!0);n<l.length&&!(l[n].start>=f);n++){k=l[n].start;var p=l[n].end;if(g<k)for(m.setText(c.substring(g-e,k-e));k=m.nextToken();)k===a?h.push(m.getStartOffset()+
g-e+d+1):k===b&&h.push(-(m.getStartOffset()+g-e+d+1));g=p}if(g<f)for(m.setText(c.substring(g-e,f-e));k=m.nextToken();)k===a?h.push(m.getStartOffset()+g-e+d+1):k===b&&h.push(-(m.getStartOffset()+g-e+d+1));return h},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){a.textView===this.view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view;a=d.getModel();var e;
if(this.highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var h=c.start===c.end,b=b.start===b.end;f===e&&b&&h||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&h&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,m,k;if(c.start===c.end&&0<(k=d.getCaretOffset()))k-=1,a.getBaseModel&&(k=a.mapOffset(k),a=a.getBaseModel()),a=this._findMatchingBracket(a,k),-1!==a&&(m=[g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_CURRENT_BRACKET,k,k+1)]);this._bracketAnnotations=m;this.annotationModel.replaceAnnotations(b,m)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(0<d){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());e=this._findMatchingBracket(f,e);-1!==e&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>a&&(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=
a.start,c=a.removedCharCount,d=a.addedCharCount-c,e=this.view;a=e.getModel();var f=a.getBaseModel?a.getBaseModel():a,c=b+c,h=f.getCharCount(),m=this.comments.length,k=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(this.comments,k,!0),n=this._binarySearch(this.comments,c,!1,l-1,m);l<m&&this.comments[l].start<=k&&k<this.comments[l].end?(k=this.comments[l].start,k>b&&(k+=d)):k=l===m&&0<m&&h-d===this.comments[m-1].end?this.comments[m-1].start:k;var p;n<m?(p=this.comments[n].end,p>b&&(p+=d),
n+=1):(n=m,p=h);for(var h=f.getText(k,p),q,h=this._findComments(h,k),m=l;m<this.comments.length;m++)q=this.comments[m],q.start>b&&(q.start+=d),q.start>b&&(q.end+=d);var A=n-l!==h.length;if(!A)for(m=0;m<h.length;m++){q=this.comments[l+m];var w=h[m];if(q.start!==w.start||q.end!==w.end||q.type!==w.type){A=!0;break}}m=[l,n-l].concat(h);Array.prototype.splice.apply(this.comments,m);A&&(m=k,q=p,a!==f&&(m=a.mapOffset(m,!0),q=a.mapOffset(q,!0)),e.redrawRange(m,q));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=
this.annotationModel;l=e.getAnnotations(k,p);k=[];for(p=[];l.hasNext();)if(q=l.next(),q.type===g.AnnotationType.ANNOTATION_FOLDING){p.push(q);for(m=0;m<h.length&&!(q.start===h[m].start&&q.end===h[m].end);m++);m===h.length?(k.push(q),q.expand()):(m=q.start,n=q.end,m>b&&(m-=d),n>b&&(n-=d),m<=b&&b<n&&m<=c&&c<n&&(m=f.getLineAtOffset(q.start),n=f.getLineAtOffset(q.end),m!==n?q.expanded||q.expand():e.removeAnnotation(q)))}b=[];for(m=0;m<h.length;m++){q=h[m];for(d=0;d<p.length&&!(p[d].start===q.start&&p[d].end===
q.end);d++);d===p.length&&(q=this._createFoldingAnnotation(a,f,q.start,q.end))&&b.push(q)}e.replaceAnnotations(k,b)}}};return{TextStyler:c}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(g){function l(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function k(a,b,c,d,e){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.pattern=b;this._styler=c;this._parent=e;this._linePatterns=[];this._blockPatterns=[];this._enclosurePatterns=
{};d&&(this._initPatterns(),this._subBlocks=x(d,d.getText(this.start,this.end),this,this.start))}function e(a){this._styler=a}function d(a,b,c,d){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new l(c,d);this._accessor=new e(this);this._bracketAnnotations=void 0;var f=this;this._listener={onChanged:function(a){f._onModelChanged(a)},onDestroy:function(a){f._onDestroy(a)},
onLineStyle:function(a){f._onLineStyle(a)},onMouseDown:function(a){f._onMouseDown(a)},onSelection:function(a){f._onSelection(a)}};c=a.getModel();c.getBaseModel&&(c=c.getBaseModel());c.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);d=c.getCharCount();this._rootBlock=
new k({start:0,contentStart:0,end:d,contentEnd:d},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(d=[],z(this._rootBlock,c,d),b.replaceAnnotations([],d));a.redrawLines()}var h={styleClass:"meta annotation currentLine"},b=/$/,f=/\\(\d)/g,c=/^\(\?i\)\s*/,m=/(.*)(?:[\r\n]|$)/g,a={regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},n={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},q=function(a,b,c,d){var e=c,f=
a.lastIndex;m.lastIndex=c;c=m.exec(b);var h,g;a.lastIndex=0;if(c){for(g=c.index;0<=--g&&!(h=b.charAt(g),"\n"===h||"\r"===h););h=b.substring(g+1,c.index+c[1].length);a.lastIndex=g=c.index-g-1}for(;c&&c.index<b.length;){var k;if(d){var l=a.lastIndex;a.test(h)&&(a.lastIndex=l,k=a.exec(h))}else k=a.exec(h);if(k)return k.index+=e,k.index-=g,a.lastIndex=f,k;g=0;e+=c[0].length;if(c=m.exec(b))h=c[1],a.lastIndex=0}a.lastIndex=f;return null},s=function(a,b){var c=a.toString();f.lastIndex=0;if(!f.test(c))return a;
f.lastIndex=0;for(var d=f.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),f.lastIndex=0,d=f.exec(c);return RegExp(c.substring(1,c.length-1-1),"g")},t=function(a,b,c,d){if(b=q(a.pattern.regex?a.pattern.regex:a.pattern.regexBegin,b,d,!0)){a.result=b;for(d=0;d<c.length;d++)if(b.index<c[d].result.index||b.index===c[d].result.index&&a.pattern.pattern.index<c[d].pattern.pattern.index){c.splice(d,0,a);return}c.push(a)}},y=function(a,b,c,d){if(b[0])d.push({start:c,end:c+a[0].length,style:b[0].name});else for(var e=
0,f=1;f<a.length;f++)if(a[f]){var h=b[f];if(h){var g=c+e;d.push({start:g,end:g+a[f].length,style:h.name})}e+=a[f].length}},u=function(a,b,c){var d=a.start;b.forEach(function(b){d<=b.start&&c.push({start:d,end:b.start,style:a.style});c.push(b);d=b.end});d<a.end&&c.push({start:d,end:a.end,style:a.style})},v=function(a,c,d,e,f){if(a&&(d=d.getLinePatterns())){var h=[];d.forEach(function(b){var c=b.regex||b.regexBegin;c.oldLastIndex=c.lastIndex;(c=q(c,a,0))&&h.push({result:c,pattern:b})});h.sort(function(a,
b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var g=0;0<h.length;){var m=h[0];h.splice(0,1);if(!(m.result.index<g)){var k=m.result.index,l,n=[];if(m.pattern.regex){g=m.result;l=k+g[0].length;l={start:c+k,end:c+l,style:m.pattern.pattern.name};if(!f){m.pattern.pattern.captures&&y(g,m.pattern.pattern.captures,c+k,n);n.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(k=0;k<n.length-1;k++)if(n[k+
1].start<n[k].end){var z={start:n[k+1].end,end:n[k].end,style:n[k].style};n[k].end=n[k+1].start;n.splice(k+2,0,z)}}u(l,n,e)}else g=m.pattern.regexEnd,g=s(g,m.result),(g=q(g,a,m.result.index+m.result[0].length))||(b.lastIndex=0,g=b.exec(a)),l=g.index+g[0].length,e.push({start:c+k,end:c+l,style:m.pattern.pattern.name});g=g.index+g[0].length}t(m,a,h,g)}d.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},x=function(a,c,d,e){if(!c)return[];var f=[],h=[];d.getBlockPatterns().forEach(function(a){var b=
q(a.regexBegin||a.regex,c,0);b&&h.push({result:b,pattern:a})}.bind(this));if(!h.length)return f;h.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var g=0;0<h.length;){var m=h[0];h.splice(0,1);if(!(m.result.index<g)){var g=e+m.result.index,l=m.result.index,n=null,z=m.pattern.regexEnd;if(z){var l=l+m.result[0].length,u=m.pattern,v=s(z,m.result);v!==z&&(u={pattern:u.pattern,regexBegin:u.regexBegin,regexEnd:v},
z=v);for(v=l;!n;){(v=q(z,c,v))||(b.lastIndex=0,v=b.exec(c));var x=new k({start:g,end:e+v.index+v[0].length,contentStart:e+l,contentEnd:e+v.index},u,d.getStyler(),a,d),y=x.getBlocks();if(!y.length||y[y.length-1].end<=v.index+e)n=x;v=v.index+v[0].length}}else n=new k({start:g,end:g+m.result[0].length,contentStart:g,contentEnd:g+m.result[0].length},m.pattern,d.getStyler(),a,d);f.push(n);g=n.end-e}t(m,c,h,g)}return f},z=function(a,b,c){if(a.getAnnotationModel()){var d=g.AnnotationType.ANNOTATION_TASK;
if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&0===a.pattern.pattern.name.indexOf("comment")){var e=[];v(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)"meta.annotation.task.todo"===e[f].style&&c.push(g.AnnotationType.createAnnotation(d,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){z(a,b,c)}.bind(this))}};l.prototype={getPatterns:function(a){a?(a="string"===typeof a?a:a.qualifiedId,a+="#"):a=this._rootId+
"#"+this._NO_ID;var b=[0],c={},d=RegExp("^"+a+"[^#]+$");this._patterns.forEach(function(a){d.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,c):(a.index=b[0]++,c[a.id]=a))}.bind(this));var e=[];Object.keys(c).forEach(function(a){e.push(c[a])});return e},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},_addRepositoryPatterns:function(a,b){Object.keys(a).forEach(function(c){this._addPattern(a[c],c,b)}.bind(this))},_addPattern:function(a,
b,c){a.parentId=c;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_processInclude:function(a,b,c){var d,e=a.include.indexOf("#");d=0===e?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):-1===e?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");this._patterns.forEach(function(a){d.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,c):c[a.id]||(a.index=b[0]++,
c[a.id]=a))}.bind(this))},_NO_ID:"NoID"};k.prototype={adjustEnd:function(a){this.end+=a;this.contentEnd+=a;this._subBlocks.forEach(function(b){b.adjustEnd(a)})},adjustStart:function(a){this.start+=a;this.contentStart+=a;this._subBlocks.forEach(function(b){b.adjustStart(a)})},computeStyle:function(a,b){if(!this.pattern||!(this.start<=b&&b<this.end))return null;var c={start:this.start,end:this.end,style:this.pattern.pattern.name};if(this.contentStart<=b&&b<this.contentEnd)return this.pattern.pattern.contentName?
{start:this.contentStart,end:this.contentEnd,style:this.pattern.pattern.contentName}:c;var d,e,f,h;if(b<this.contentStart){e=this.pattern.pattern.beginCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexBegin;f=a.getText(this.start,this.contentStart);h=this.start}else{e=this.pattern.pattern.endCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexEnd;f=a.getText(this.contentEnd,this.end);h=this.contentEnd}d.lastIndex=0;if(f=d.exec(f)){d=[];y(f,e,h,d);for(e=
0;e<d.length;e++)if(d[e].start<=b&&b<d[e].end)return d[e]}return c},getAnnotationModel:function(){return this._styler._getAnnotationModel()},getBlockPatterns:function(){return this._blockPatterns},getBlocks:function(){return this._subBlocks},getEnclosurePatterns:function(){return this._enclosurePatterns},getLinePatterns:function(){return this._linePatterns},getParent:function(){return this._parent},getPatternManager:function(){return this._styler._getPatternManager()},getPatterns:function(){return this.getLinePatterns()},
getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){if(this.pattern&&this.pattern.pattern._linePatterns)this._linePatterns=this.pattern.pattern._linePatterns,this._blockPatterns=this.pattern.pattern._blockPatterns,this._enclosurePatterns=this.pattern.pattern._enclosurePatterns;else{var a=function(a){a="string"===typeof a?a:a.match;var b=c.exec(a),d="g";b&&(a=a.substring(b[0].length),d+="i");return RegExp(a,
d)},b=-1,d=0;this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(c){var e;if(c.match&&!c.begin&&!c.end){if(e={regex:a(c.match),pattern:c},this._linePatterns.push(e),c.name&&0===c.name.indexOf("punctuation.section")&&(-1!==c.name.indexOf(".begin")||-1!==c.name.indexOf(".end")))this._enclosurePatterns[c.name]=e}else!c.match&&c.begin&&c.end&&(b=d,e={regexBegin:a(c.begin),regexEnd:a(c.end),pattern:c},this._linePatterns.push(e));d++}.bind(this));this._blockPatterns=
this._linePatterns.slice(0,b+1);this.pattern&&(this.pattern.pattern._enclosurePatterns=this._enclosurePatterns,this.pattern.pattern._linePatterns=this._linePatterns,this.pattern.pattern._blockPatterns=this._blockPatterns)}}};e.prototype={getPatterns:function(a){return this._styler.getPatterns(a)},getStyles:function(a){return this._styler.getStyles(a)}};d.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);
a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},getPatterns:function(a){return this._findBlock(this._rootBlock,a).getPatterns()},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var b=[],c=this.view.getModel();c.getBaseModel&&(c=c.getBaseModel());var d=this._findBlock(this._rootBlock,
a),e=c.getLineAtOffset(a),f=c.getLine(e),h=[];v(f,c.getLineStart(e),d,h);for(e=0;e<h.length&&!(a<h[e].start);e++)if(h[e].start<=a&&a<h[e].end){b.push(h[e]);break}for(;d;)(h=d.computeStyle(c,a))&&b.splice(0,0,h),d=d.getParent();return b},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||
this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;void 0===d&&(d=-1);for(void 0===e&&(e=a.length);1<e-d;)if(f=Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=
f;break}else d=f;return e},_computeFolding:function(a){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var c=this.annotationModel;if(c){c.removeAnnotations(g.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=b.getBaseModel(),f=0;f<a.length;f++){var h=a[f];(h=this._createFoldingAnnotation(b,e,h.start,h.end))&&d.push(h)}c.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c);b=b.getLineAtOffset(d);return e===b?null:new (g.AnnotationType.getType(g.AnnotationType.ANNOTATION_FOLDING))(c,
d,a)},_findBlock:function(a,b){var c=a.getBlocks();if(!c.length)return a;var d=this._binarySearch(c,b,!0);return d<c.length&&c[d].start<=b&&b<c[d].end?this._findBlock(c[d],b):a},_findBrackets:function(a,b,c,d,e,f){for(var h=[],g=[],m=e,k=c.getBlocks(),l=this._binarySearch(k,e,!0);l<k.length&&!(k[l].start>=f);l++){var n=k[l].start,q=k[l].end;m<n&&(v(d.substring(m-e,n-e),m,c,g),g.forEach(function(c){0===c.style.indexOf(a.pattern.name)?h.push(c.start+1):0===c.style.indexOf(b.pattern.name)&&h.push(-(c.start+
1))}),g=[]);m=q}m<f&&(v(d.substring(m-e,f-e),m,c,g),g.forEach(function(c){0===c.style.indexOf(a.pattern.name)?h.push(c.start+1):0===c.style.indexOf(b.pattern.name)&&h.push(-(c.start+1))}));return h},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),e=a.getLineEnd(d),f=a.getText(c,e),h,g=b.getEnclosurePatterns(),m=Object.keys(g),k=0;k<m.length;k++){var l=g[m[k]],n=q(l.regex,f,0);if(n&&0===n.index){h=l;break}}if(!h)return-1;f=!1;-1!==h.pattern.name.indexOf(".begin")?(f=!0,k=h.pattern.name.replace(".begin",
".end")):k=h.pattern.name.replace(".end",".begin");g=g[k];if(!g)return-1;m=a.getLine(d);l=a.getLineStart(d);e=this._findBrackets(h,g,b,m,l,e);for(k=0;k<e.length;k++)if(m=0<=e[k]?1:-1,e[k]*m-1===c){c=1;if(f){for(k++;k<e.length;k++)if(m=0<=e[k]?1:-1,c+=m,0===c)return e[k]*m-1;d+=1;for(k=a.getLineCount();d<k;){m=a.getLine(d);l=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(h,g,b,m,l,e);for(f=0;f<e.length;f++)if(m=0<=e[f]?1:-1,c+=m,0===c)return e[f]*m-1;d++}}else{for(k--;0<=k;k--)if(m=0<=e[k]?
1:-1,c+=m,0===c)return e[k]*m-1;for(d-=1;0<=d;){m=a.getLine(d);l=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(h,g,b,m,l,e);for(k=e.length-1;0<=k;k--)if(m=0<=e[k]?1:-1,c+=m,0===c)return e[k]*m-1;d--}}break}return-1},_getAnnotationModel:function(){return this.annotationModel},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===a)return h}return null},_getPatternManager:function(){return this.patternManager},
_getStyles:function(a,b,c,d){b.getBaseModel&&(d=b.mapOffset(d));for(var e=d+c.length,f=[],h=d,g=a.getBlocks(),m=this._binarySearch(g,d,!0);m<g.length&&!(g[m].start>=e);m++){var k=g[m].start,l=g[m].end;h<k&&v(c.substring(h-d,k-d),h,a,f);var n=Math.max(h,k);if(n===k&&g[m].pattern.regexBegin){var s=q(g[m].pattern.regexBegin,c.substring(n-d),0);if(s){var z=g[m].pattern.pattern.beginCaptures||g[m].pattern.pattern.captures;z?y(s,z,n,f):f.push({start:n,end:n+s[0].length,style:g[m].pattern.pattern.name});
n+=s[0].length}}var k=Math.min(e,l),u=[];if(k===l&&g[m].pattern.regexEnd&&(h=c.substring(k-h-(g[m].end-g[m].contentEnd)),s=q(g[m].pattern.regexEnd,h,0)))(z=g[m].pattern.pattern.endCaptures||g[m].pattern.pattern.captures)?y(s,z,k-s[0].length,u):g[m].pattern.pattern.name&&u.push({start:k-s[0].length,end:k,style:g[m].pattern.pattern.name}),k-=s[0].length;var h=this._getStyles(g[m],b,c.substring(n-d,k-d),n),t=g[m].pattern.pattern.contentName||g[m].pattern.pattern.name;if(t){var x=n;h.forEach(function(a){a.start-
x&&f.push({start:x,end:a.start,style:t});f.push(a);x=a.end});k-x&&f.push({start:x,end:k,style:t})}else f=f.concat(h);f=f.concat(u);h=l}h<e&&v(c.substring(h-d,e-d),h,a,f);if(b.getBaseModel)for(a=0;a<f.length;a++)c=f[a].end-f[a].start,f[a].start=b.mapOffset(f[a].start,!0),f[a].end=f[a].start+c;return f},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(a){this.destroy()},_onLineStyle:function(b){b.textView===this.view&&(b.style=
this._getLineStyle(b.lineIndex));b.ranges=this._getStyles(this._rootBlock,b.textView.getModel(),b.lineText,b.lineStart);b.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(a,b.ranges,b.lineText,b.lineStart),this.tabsVisible&&this._spliceStyles(n,b.ranges,b.lineText,b.lineStart))},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view;a=d.getModel();var e;if(this.highlightCaretLine){var f=
a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var h=c.start===c.end,b=b.start===b.end;f===e&&b&&h||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&h&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,m,k;if(c.start===c.end&&0<(k=d.getCaretOffset()))k-=1,a.getBaseModel&&(k=a.mapOffset(k),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,k),a=this._findMatchingBracket(a,c,k),-1!==a&&(m=[g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,
a+1),g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_CURRENT_BRACKET,k,k+1)]);this._bracketAnnotations=m;this.annotationModel.replaceAnnotations(b,m)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(0<d){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());var h=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,h,e);-1!==e&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>a&&
(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=a.start,c=a.removedCharCount;a=a.addedCharCount-c;var d=this.view,e=d.getModel(),f=e.getBaseModel?e.getBaseModel():e,c=b+c,h=f.getCharCount(),m=this._rootBlock.getBlocks(),k=m.length,l=f.getLineStart(f.getLineAtOffset(b)),n=this._binarySearch(m,l,!0),q=this._binarySearch(m,c,!1,n-1,k),s;n<k&&m[n].start<=l&&l<m[n].end?(s=m[n].start,s>b&&(s+=a)):s=n===k&&0<k&&h-a===m[k-1].end?m[k-1].start:l;var v;do q<k?(v=m[q].end,v>b&&(v+=a),q+=1):
(q=k,v=h),l=f.getText(s,v),l=x(f,l,this._rootBlock,s);while(l.length&&m.length&&q<k&&l[l.length-1].pattern.pattern.id!==m[q-1].pattern.pattern.id);for(h=n;h<m.length;h++)k=m[h],k.start>b&&k.adjustStart(a),k.start>b&&k.adjustEnd(a);var u=q-n!==l.length;if(!u)for(h=0;h<l.length;h++){var k=m[n+h],t=l[h];if(k.start!==t.start||k.end!==t.end||k.type!==t.type){u=!0;break}}h=[n,q-n].concat(l);Array.prototype.splice.apply(m,h);u&&(h=s,k=v,e!==f&&(h=e.mapOffset(h,!0),k=e.mapOffset(k,!0)),d.redrawRange(h,k));
if(this.annotationModel){d=[];m=[];n=[];s=this.annotationModel.getAnnotations(s,v);for(v=this.foldingEnabled&&f!==e;s.hasNext();)if(k=s.next(),v&&k.type===g.AnnotationType.ANNOTATION_FOLDING){n.push(k);for(h=0;h<l.length&&!(k.start===l[h].start&&k.end===l[h].end);h++);h===l.length?(d.push(k),k.expand()):(h=k.start,q=k.end,h>b&&(h-=a),q>b&&(q-=a),h<=b&&b<q&&h<=c&&c<q&&(h=f.getLineAtOffset(k.start),q=f.getLineAtOffset(k.end),h!==q?k.expanded||k.expand():this.annotationModel.removeAnnotation(k)));for(h=
0;h<l.length;h++){k=l[h];for(q=0;q<n.length&&!(n[q].start===k.start&&n[q].end===k.end);q++);q===n.length&&(k=this._createFoldingAnnotation(e,f,k.start,k.end))&&m.push(k)}}else k.type===g.AnnotationType.ANNOTATION_TASK&&d.push(k);if(this.detectTasks)for(h=0;h<l.length;h++)z(l[h],f,m);this.annotationModel.replaceAnnotations(d,m)}},_spliceStyles:function(a,b,c,d){for(var e=a.regex,f=e.lastIndex=0,h=e.exec(c);h;){for(h=d+h.index;f<b.length&&!(h<b[f].end);)f++;var g={start:h,end:h+1,style:a.style};if(f<
b.length&&b[f].start<=h){var m={start:h+1,end:b[f].end,style:b[f].style};b[f].end=h;b.splice(f+1,0,m);b.splice(f+1,0,g);f+=2}else b.splice(f,0,g),f++;h=e.exec(c)}}};return{TextStyler:d}});
define("orion/editor/textMateStyler",["orion/regex"],function(g){function l(d){var e;if(d instanceof Array){e=Array(d.length);for(var b=0;b<d.length;b++)e[b]=l(d[b])}else for(b in e={},d)if(Object.prototype.hasOwnProperty.call(d,b)){var f=d[b];e[b]="object"===typeof f&&null!==f?l(f):f}return e}function k(d,e,b){this.initialize(d);this.grammar=l(e);this.externalGrammars=b?l(b):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var e={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(d){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(d){return"\x3d"===d[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(d){return"atomic group"}}],toRegExp:function(d){function h(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var b="",f;d=e.processGlobalFlag("x",d,function(b){for(var a="",c=!1,d=b.length,e=0;e<d;){var f=b.charAt(e);if(!c&&"#"===f)for(;e<d&&"\r"!==f&&"\n"!==f;)f=b.charAt(++e);
else if(!c&&/\s/.test(f))for(;e<d&&/\s/.test(f);)f=b.charAt(++e);else"\\"===f?(a+=f,/\s/.test(b.charAt(e+1))||(a+=b.charAt(e+1),e+=1)):("["===f?c=!0:"]"===f&&(c=!1),a+=f),e+=1}return a});d=e.processGlobalFlag("i",d,function(c){b+="i";return c});for(f=0;f<this.unsupported.length;f++){var c;(c=this.unsupported[f].regex.exec(d))&&h(this.unsupported[f].func(c),c)}return RegExp(d,b)},processGlobalFlag:function(d,e,b){var f="(?"+d+")";d="(?"+d+":";if(e.substring(0,f.length)===f)return b(e.substring(f.length));
if(e.substring(0,d.length)===d){for(var f=0,c=e.length,g=-1,a=0;a<c&&-1===g;a++)switch(e.charAt(a)){case "\\":a++;break;case "(":f++;break;case ")":f--,0===f&&(g=a)}f=g;if(f<e.length-1)throw Error("Only a "+d+") group that encloses the entire regex is supported in: "+e);return b(e.substring(d.length,f))}return e},hasBackReference:function(d){return/\\\d+/.test(d.source)},getSubstitutedRegex:function(d,e,b){b="undefined"===typeof b?!0:!1;d=d.source.split(/(\\\d+)/g);for(var f=[],c=0;c<d.length;c++){var m=
d[c],a=/\\(\d+)/.exec(m);a?(m=e[a[1]]||"",f.push(b?g.escape(m):m)):f.push(m)}return RegExp(f.join(""))},groupify:function(d,e){for(var b=d.source,f=b.length,c=[],g=0,a=[],k=1,l=1,s=[],t={},y={},u=0;u<f;u++){var v=c[c.length-1],x=b.charAt(u);switch(x){case "(":4===v&&(c.pop(),s.push(")"),a[a.length-1].end=u);var z=u+2<f?b.charAt(u+1)+""+b.charAt(u+2):null;if("?:"===z||"?\x3d"===z||"?!"===z){var A;"?:"===z?A=1:(A=3,g++);c.push(A);a.push({start:u,end:-1,type:A});s.push(x);s.push(z);u+=z.length}else c.push(2),
a.push({start:u,end:-1,type:2,oldNum:k,num:l}),s.push(x),0===g&&(y[l]=null),t[k]=l,k++,l++;break;case ")":v=c.pop();3===v&&g--;a[a.length-1].end=u;s.push(x);break;case "*":case "+":case "?":case "}":var C=x,p=b.charAt(u-1),z=u-1;if("}"===x){for(A=u-1;"{"!==b.charAt(A)&&0<=A;A--);p=b.charAt(A-1);z=A-1;C=b.substring(A,u+1)}A=a[a.length-1];if(")"===p&&(2===A.type||4===A.type)){s.splice(A.start,0,"(");s.push(C);s.push(")");x={start:A.start,end:s.length-1,type:4,num:A.num};for(p=0;p<a.length;p++)if(v=
a[p],(2===v.type||4===v.type)&&v.start>=A.start&&v.end<=z)v.start+=1,v.end+=1,v.num+=1,2===v.type&&(t[v.oldNum]=v.num);a.push(x);l++;break}default:"|"!==x&&2!==v&&4!==v&&0===g&&(c.push(4),a.push({start:u,end:-1,type:4,num:l}),s.push("("),y[l]=null,l++),s.push(x),"\\"===x&&(x=b.charAt(u+1),s.push(x),u+=1)}}for(;c.length;)c.pop(),s.push(")");b=RegExp(s.join(""));f={};e=e||t;for(var w in e)e.hasOwnProperty(w)&&(f[w]="\\"+e[w]);b=this.getSubstitutedRegex(b,f,!1);return[b,t,y]},complexCaptures:function(d){if(!d)return!1;
for(var e in d)if(d.hasOwnProperty(e)&&"0"!==e)return!0;return!1}};k.prototype={initialize:function(d){this.textView=d;this.textView.stylerOptions=this;var e=this;this._listener={onModelChanged:function(b){e.onModelChanged(b)},onDestroy:function(b){e.onDestroy(b)},onLineStyle:function(b){e.onLineStyle(b)},onStorage:function(b){e.onStorage(b)}};d.addEventListener("ModelChanged",this._listener.onModelChanged);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",this._listener.onLineStyle);
d.redrawLines()},onDestroy:function(d){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null);this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(d){for(d=[d];0!==d.length;){var e=d.pop();if(!e._resolvedRule||!e._typedRule)if(e._resolvedRule=
this._resolve(e),e._typedRule=this._createTypedRule(e),this.addStyles(e.name),this.addStyles(e.contentName),this.addStylesForCaptures(e.captures),this.addStylesForCaptures(e.beginCaptures),this.addStylesForCaptures(e.endCaptures),e._resolvedRule!==e&&d.push(e._resolvedRule),e.patterns)for(var b=0;b<e.patterns.length;b++)d.push(e.patterns[b])}},addStyles:function(d){if(d&&!this._styles[d]){this._styles[d]=[];for(var e=d.split("."),b=0;b<e.length;b++)this._styles[d].push(e.slice(0,b+1).join("-"))}},
addStylesForCaptures:function(d){for(var e in d)d.hasOwnProperty(e)&&this.addStyles(d[e].name)},ContainerRule:function(){function d(d){this.rule=d;this.subrules=d.patterns}d.prototype.valueOf=function(){return"aa"};return d}(),BeginEndRule:function(){function d(d){this.rule=d;this.beginRegex=e.toRegExp(d.begin);this.endRegex=e.toRegExp(d.end);this.subrules=d.patterns||[];this.endRegexHasBackRef=e.hasBackReference(this.endRegex);var b=e.complexCaptures(d.captures);d=e.complexCaptures(d.beginCaptures)||
e.complexCaptures(d.endCaptures);if(this.isComplex=b||d)b=e.groupify(this.beginRegex),this.beginRegex=b[0],this.beginOld2New=b[1],this.beginConsuming=b[2],b=e.groupify(this.endRegex,this.beginOld2New),this.endRegex=b[0],this.endOld2New=b[1],this.endConsuming=b[2]}d.prototype.valueOf=function(){return this.beginRegex};return d}(),MatchRule:function(){function d(d){this.rule=d;this.matchRegex=e.toRegExp(d.match);if(this.isComplex=e.complexCaptures(d.captures))d=e.groupify(this.matchRegex),this.matchRegex=
d[0],this.matchOld2New=d[1],this.matchConsuming=d[2]}d.prototype.valueOf=function(){return this.matchRegex};return d}(),_createTypedRule:function(d){return d.match?new this.MatchRule(d):d.begin?new this.BeginEndRule(d):new this.ContainerRule(d)},_resolve:function(d){var e=d;if(d.include){if(d.begin||d.end||d.match)throw Error('Unexpected regex pattern in "include" rule '+d.include);d=d.include;if("#"===d.charAt(0)){if(e=this.grammar.repository&&this.grammar.repository[d.substring(1)],!e)throw Error("Couldn't find included rule "+
d+" in grammar repository");}else if("$self"===d)e=this.grammar;else{if("$base"===d)throw Error('Include "$base" is not supported');e=this._allGrammars[d];if(!e)for(var b=0;b<this.externalGrammars.length;b++){var f=this.externalGrammars[b];if(f.scopeName===d){this.preprocess(f);e=this._allGrammars[d]=f;break}}}}return e},ContainerNode:function(){function d(d,b){this.parent=d;this.rule=b;this.children=[];this.end=this.start=null}d.prototype.addChild=function(d){this.children.push(d)};d.prototype.valueOf=
function(){var d=this.rule;return"ContainerNode { "+(d.include||"")+" "+(d.name||"")+(d.comment||"")+"}"};return d}(),BeginEndNode:function(){function d(d,b,f){this.parent=d;this.rule=b;this.children=[];this.setStart(f);this.endMatch=this.end=null;this.endRegexSubstituted=b.endRegexHasBackRef?e.getSubstitutedRegex(b.endRegex,f):null}d.prototype.addChild=function(d){this.children.push(d)};d.prototype.getIndexInParent=function(d){return this.parent?this.parent.children.indexOf(this):-1};d.prototype.setStart=
function(d){this.start=d.index;this.beginMatch=d};d.prototype.setEnd=function(d){d&&"object"===typeof d?(this.endMatch=d,this.end=d.index+d[0].length):(this.endMatch=null,this.end=d)};d.prototype.shiftStart=function(d){this.start+=d;this.beginMatch.index+=d};d.prototype.shiftEnd=function(d){this.end+=d;this.endMatch&&(this.endMatch.index+=d)};d.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range\x3d"+this.start+".."+this.end+"}"};return d}(),push:function(d,e){if(e)for(var b=e.length;0<
b;)d.push(e[--b])},exec:function(d,e,b){if(e=d.exec(e))e.index+=b;d.lastIndex=0;return e},afterMatch:function(d){return d.index+d[0].length},getEndMatch:function(d,e,b){if(d instanceof this.BeginEndNode){var f=d.rule;d=d.endRegexSubstituted||f.endRegex;return!d?null:this.exec(d,e,b)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree,!1,0)},onModelChanged:function(d){var e=d.addedCharCount,
b=d.removedCharCount;d=d.start;if(this._tree){var f=this.textView.getModel(),c=f.getCharCount(),f=f.getLineEnd(f.getLineAtOffset(d)-1),g=this.getFirstDamaged(f,f),f=-1===f?0:f,e=g?this.parse(g,!0,f,d,e,b):c;this.textView.redrawRange(f,e)}else this.initialParse()},getFirstDamaged:function(d,e){if(0>d)return this._tree;for(var b=[this._tree],f=null;b.length;){var c=b.pop();if(!c.parent||this.isDamaged(c,d,e)){c instanceof this.BeginEndNode&&(f=c);for(var g=0;g<c.children.length;g++)b.push(c.children[g])}}return f||
this._tree},isDamaged:function(d,e,b){return d.start<=b&&d.end>e},parse:function(d,e,b,f,c,g){var a=this.textView.getModel(),k=a.getLineStart(a.getLineCount()-1),l=a.getCharCount(),s=this.getInitialExpected(d,b),t=-1;e&&(d.repaired=!0,d.endNeedsUpdate=!0,t=(t=d.children[d.children.length-1])?a.getLineEnd(a.getLineAtOffset(t.end+(c-g))):-1,f=a.getLineEnd(a.getLineAtOffset(f+g)),t=Math.max(t,f));t=-1===t?l:t;f=s;for(var y=d,u=!1,v=b,x=-1;y&&(!e||v<t);){var z=this.getNextMatch(a,y,v);z||(v=v>=k?l:a.getLineStart(a.getLineAtOffset(v)+
1));var A=z&&z.match,C=z&&z.rule,p=z&&z.isEnd;if(z&&z.isSub)v=this.afterMatch(A),C instanceof this.BeginEndRule&&(u=!0,e&&C===f.rule&&y===f.parent?(y=f,y.setStart(A),y.repaired=!0,y.endNeedsUpdate=!0,f=this.getNextExpected(f,"begin")):(e&&(this.prune(y,f),e=!1),A=new this.BeginEndNode(y,C,A),y.addChild(A),y=A));else if(p||v===l)y instanceof this.BeginEndNode&&(A?(u=!0,x=Math.max(x,y.end),y.setEnd(A),v=this.afterMatch(A),e&&y===f&&y.parent===f.parent?(y.repaired=!0,delete y.endNeedsUpdate,f=this.getNextExpected(f,
"end")):e&&(this.prune(y,f),e=!1)):(y.setEnd(l),delete y.endNeedsUpdate)),y=y.parent;e&&v>=t&&!u&&(this.prune(d,s),e=!1)}this.removeUnrepairedChildren(d,e,b);this.cleanup(e,d,b,t,l,c,g);return e?Math.max(x,v):v},removeUnrepairedChildren:function(d,e,b){if(e){e=d.children;for(var f=-1,c=0;c<e.length;c++){var g=e[c];if(!g.repaired&&this.isDamaged(g,b,Number.MAX_VALUE)){f=c;break}}-1!==f&&(d.children.length=f)}},cleanup:function(d,e,b,f,c,g,a){if(d){d=g-a;c=this.getIntersecting(f-d+1,c);e=this.getIntersecting(b,
f);for(b=0;b<c.length;b++)f=c[b],!f.repaired&&f instanceof this.BeginEndNode&&(f.shiftEnd(d),f.shiftStart(d));for(b=0;b<e.length;b++)f=e[b],f.repaired&&f.endNeedsUpdate&&f.shiftEnd(d),delete f.endNeedsUpdate,delete f.repaired}else{e=this.getIntersecting(b,f);for(b=0;b<e.length;b++)delete e[b].repaired}},getNextMatch:function(d,e,b,f){var c=d.getLineAtOffset(b),c=d.getLineEnd(c),g=d.getText(b,c),a=[],k=[];d=[];c=[];for(this.push(a,e.rule.subrules);a.length;){var l=a.length?a.pop():null,l=l&&l._resolvedRule._typedRule;
if(l instanceof this.ContainerRule&&-1===k.indexOf(l))k.push(l),this.push(a,l.subrules);else if(!l||!f||l.matchRegex){var s=l&&this.exec(l.matchRegex||l.beginRegex,g,b);s&&(d.push(s),c.push(l))}}a=Number.MAX_VALUE;k=-1;for(l=0;l<d.length;l++)s=d[l],s.index<a&&(a=s.index,k=l);if(!f&&(b=this.getEndMatch(e,g,b)))if(f=e.rule.applyEndPatternLast,-1===k||b.index<a||!f&&b.index===a)return{isEnd:!0,rule:e.rule,match:b};return-1===k?null:{isSub:!0,rule:c[k],match:d[k]}},getInitialExpected:function(d,e){var b,
f;if(d===this._tree)for(b=0;b<d.children.length;b++){if(f=d.children[b],f.start>=e)return f}else if(d instanceof this.BeginEndNode&&d.endMatch){var c=d.endMatch.index;for(b=0;b<d.children.length&&!(f=d.children[b],f.start>=e);b++);if(f&&f.start<c)return f}return d},getNextExpected:function(d,e){if("begin"===e){var b=d.children[0];return b?b:d}if("end"===e&&(b=d.parent)){var f=b.children[b.children.indexOf(d)+1];return f?f:b}return null},prune:function(d,e){e.parent===d?d.children.length=e.getIndexInParent():
d instanceof this.BeginEndNode&&(d.endMatch=null,d.end=null);d.parent&&(d.parent.children.length=d.getIndexInParent()+1)},onLineStyle:function(d){this._tree||this.initialParse();var e=d.lineStart,b=this.textView.getModel(),f=b.getLineEnd(d.lineIndex),c=b.getLineEnd(b.getLineAtOffset(e)-1),c=this.getFirstDamaged(c,c),e=this.getLineScope(b,c,e,f);d.ranges=this.toStyleRanges(e);d.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(d,e,b,f){for(var c=b,g=this.getInitialExpected(e,
b),a=[],k=[];e&&c<f;){var l=this.getNextMatch(d,e,c);if(!l)break;var s=l&&l.match,t=l&&l.rule,y=l&&l.isSub,l=l&&l.isEnd;s.index!==c&&k.push({start:c,end:s.index,node:e});y?(c=this.afterMatch(s),t instanceof this.BeginEndRule?(this.addBeginScope(a,s,t),e=g,g=this.getNextExpected(g,"begin")):this.addMatchScope(a,s,t)):l&&(c=this.afterMatch(s),this.addEndScope(a,s,t),g=this.getNextExpected(g,"end"),e=e.parent)}c<f&&k.push({start:c,end:f,node:e});d=this.getInheritedLineScope(k,b,f);return a.concat(d)},
getInheritedLineScope:function(d,e,b){e=[];for(b=0;b<d.length;b++)for(var f=d[b],c=f.node;c;){var g=c.rule.rule,a=g.name;if(g=g.contentName||a){this.addScopeRange(e,f.start,f.end,g);break}c=c.parent}return e},addBeginScope:function(d,e,b){var f=b.rule;this.addCapturesScope(d,e,f.beginCaptures||f.captures,b.isComplex,b.beginOld2New,b.beginConsuming)},addEndScope:function(d,e,b){var f=b.rule;this.addCapturesScope(d,e,f.endCaptures||f.captures,b.isComplex,b.endOld2New,b.endConsuming)},addMatchScope:function(d,
e,b){var f=b.rule,c=f.name;(f=f.captures)?this.addCapturesScope(d,e,f,b.isComplex,b.matchOld2New,b.matchConsuming):this.addScope(d,e,c)},addScope:function(d,e,b){b&&d.push({start:e.index,end:this.afterMatch(e),scope:b})},addScopeRange:function(d,e,b,f){f&&d.push({start:e,end:b,scope:f})},addCapturesScope:function(d,e,b,f,c,g){if(b)if(f){f={1:0};for(var a=0,k=1;void 0!==e[k];k++)void 0!==g[k]&&(a+=e[k].length),void 0!==e[k+1]&&(f[k+1]=a);g=e.index;for(a=1;b[a];a++){var k=b[a].name,l=c[a],s=g+f[l];
"undefined"!==typeof e[l]&&this.addScopeRange(d,s,s+e[l].length,k)}}else this.addScope(d,e,b[0]&&b[0].name)},getIntersecting:function(d,e){for(var b=[],f=this._tree?[this._tree]:[];f.length;){var c=f.pop(),g=!1;c instanceof this.ContainerNode?g=!0:this.isDamaged(c,d,e)&&(g=!0,b.push(c));if(g)for(var g=c.children.length,a=0;a<g;a++)f.push(c.children[a])}return b.reverse()},toStyleRanges:function(d){for(var e=[],b=0;b<d.length;b++){var f=d[b],c=this._styles[f.scope];if(!c)throw Error("styles not found for "+
f.scope);c=c.join(" ");e.push({start:f.start,end:f.end,style:{styleClass:c}})}return e}};return{RegexUtil:e,TextMateStyler:k}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(g,l){function k(b){return-1!==b.getProperty("objectClass").indexOf(d)&&"highlighter"===b.getProperty("type")}function e(b,d,c){this.initialize(b,d,c);this.lineStyles=[]}var d="orion.edit.highlighter",h=d+" service must be an event emitter";l.AnnotationType.registerType("orion.annotation.highlightError",{title:g.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
e.prototype={initialize:function(b,e,c){this.textView=b;this.serviceRegistry=e;this.annotationModel=c;this.services=[];var g=this;this.listener={onModelChanging:function(a){g.onModelChanging(a)},onModelChanged:function(a){g.onModelChanged(a)},onDestroy:function(a){g.onDestroy(a)},onLineStyle:function(a){g.onLineStyle(a)},onStyleReady:function(a){g.onStyleReady(a)},onServiceAdded:function(a){g.onServiceAdded(a.serviceReference,g.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){g.onServiceRemoved(a.serviceReference,
g.serviceRegistry.getService(a.serviceReference))}};b.addEventListener("ModelChanging",this.listener.onModelChanging);b.addEventListener("ModelChanged",this.listener.onModelChanged);b.addEventListener("Destroy",this.listener.onDestroy);b.addEventListener("LineStyle",this.listener.onLineStyle);e.addEventListener("registered",this.listener.onServiceAdded);e.addEventListener("unregistering",this.listener.onServiceRemoved);b=e.getServiceReferences(d);for(c=0;c<b.length;c++){var a=b[c];k(a)&&this.addServiceListener(e.getService(a))}},
onDestroy:function(b){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null);if(this.services){for(var b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
null}this.serviceRegistry&&(this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null);this.lineStyles=this.listener=null},onModelChanging:function(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var d=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[d,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
onStyleReady:function(b){var d=b.lineStyles||b.style;b=Number.MAX_VALUE;var c=-1,e=this.textView.getModel(),a;for(a in d)Object.prototype.hasOwnProperty.call(d,a)&&(this.lineStyles[a]=d[a],b=Math.min(b,a),c=Math.max(c,a));b=Math.max(b,0);c=Math.min(c,e.getLineCount());if(d=this.annotationModel){for(var g=d.getAnnotations(e.getLineStart(b),e.getLineEnd(c)),h=[];g.hasNext();){var k=g.next();"orion.annotation.highlightError"===k.type&&h.push(k)}g=[];for(k=b;k<=c;k++){a=k;var t=this.lineStyles[a],t=t&&
t.errors;a=e.getLineStart(a);if(t)for(var y=0;y<t.length;y++){var u=t[y];g.push(l.AnnotationType.createAnnotation("orion.annotation.highlightError",u.start+a,u.end+a))}}d.replaceAnnotations(h,g)}this.textView.redrawLines(b,c+1)},onLineStyle:function(b){var d=this.lineStyles[b.lineIndex];if(d)if(d.ranges){for(var d=d.ranges,c=b.lineStart,e=d.length,a=[],g=0;g<e;g++){var h=d[g];a.push({start:h.start+c,end:h.end+c,style:h.style})}b.ranges=a}else d.style&&(b.style=d.style)},_getEmptyStyle:function(b){for(var d=
[],c=0;c<b;c++)d.push(null);return d},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var d=this.services[b];if(d.setContentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}},onServiceAdded:function(b,d){k(b)&&this.addServiceListener(d)},onServiceRemoved:function(b,
d){-1!==this.services.indexOf(d)&&this.removeServiceListener(d)},addServiceListener:function(b){if("function"===typeof b.addEventListener){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(h))},removeServiceListener:function(b){"function"===typeof b.removeEventListener?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),-1!==b&&this.services.splice(b,1)):"undefined"!==typeof console&&console.log(Error(h))}};return e});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(g,l,k,e,d){function h(b,h,a,n,q,s,t){function y(b,c){var e=b.getProperty("contentType")||b.getProperty("contentTypes"),f=b.getProperty("fileTypes");return e?d.when(h.isSomeExtensionOf(a,e)).then(function(a){return a?b:null}):c&&f&&-1!==f.indexOf(c)?(e=new d,e.resolve(b),e):null}function u(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new g.TextStyler(n,"js",q);break;case "text/x-java-source":b=new g.TextStyler(n,"java",q);break;case "text/css":b=new g.TextStyler(n,"css",q)}return b}if(!f){var v=u(a);if(v)return s=new d,s.resolve(v),s}f&&!this.orionGrammars&&(this.orionGrammars={});v=s&&s.split(".").pop().toLowerCase();s=b.getServiceReferences("orion.edit.highlighter");for(var x=[],z=[],A=0;A<s.length;A++){var C=s[A],p=C.getProperty("type");"grammar"===p||!f&&"undefined"===typeof p?x.push(C.getProperty("grammar")):"highlighter"!==
p&&(p=C.getProperty("id"))&&!this.orionGrammars[p]&&(this.orionGrammars[p]={id:p,contentTypes:C.getProperty("contentTypes"),patterns:C.getProperty("patterns"),repository:C.getProperty("repository")});(C=y(C,v))&&z.push(C)}return d.all(z,function(a){return{_error:a}}).then(function(d){for(var g,h=d.length-1;0<=h;h--){var m=d[h];if(m&&!m._error&&(t||"highlighter"!==m.getProperty("type"))){g=m;break}}var p;if(g)if(d=g.getProperty("type"),"highlighter"===d)p=new e(n,b,q),p.setContentType(a);else if("grammar"===
d||!f&&"undefined"===typeof d)g=g.getProperty("grammar"),p=new k.TextMateStyler(n,g,x);else if(f){p=[];for(var s in this.orionGrammars)p.push(this.orionGrammars[s]);p=new l.TextStyler(n,q,p,g.getProperty("id"))}return p})}function b(b,d){this.serviceRegistry=b;this.contentTypeService=d;this.styler=null}var f=1;b.prototype={setup:function(b,d,a,e,f){f="undefined"===typeof f?!0:f;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var g=this;return h(this.serviceRegistry,this.contentTypeService?
this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),b,d,a,e,f).then(function(a){return g.styler=a})},getStyler:function(){return this.styler}};return{createStyler:h,SyntaxHighlighter:b}});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(g){function l(k,e,d){g.attach(this);this._binderFunc=e;this.setInputField(k);(k=d?d.group:null)||(k=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=k+"__completion__";this._proposeFromStart=d?d.proposeFromStart:!1;this._extendedProvider=d?d.extendedProvider:null;this._serviceRegistry=d?d.serviceRegistry:null;this._onDelete=d?d.onDelete:null;this._deleteToolTips=
d?d.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];d=function(d){this._binderFunc&&this._binderFunc(function(b){this._bind(b);d.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",d);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:d});d=function(d){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",d);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:d});d=function(d){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",d);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:d})}l.prototype._removeListeners=function(g){g&&g.forEach(function(e){e.evtTarget.removeEventListener(e.type,e.handler,!1)})};l.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};l.prototype.hasValueOf=function(g){return this._dataList.some(function(e){return e.value===g})};l.prototype.setInputField=function(g){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=g;"string"===typeof this._inputField&&(this._inputField=document.getElementById(this._inputField));g=function(e){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",g);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:g});g=function(e){this.onKeyDown(e)}.bind(this);this._inputField.addEventListener("keydown",g);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:g});g=function(e){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",g);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:g});g=function(e){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(d){this._bind(d)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",g);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:g})};l.prototype.onKeyDown=function(g){if(this._dismissed)return!0;var e=g.charCode||g.keyCode;if(13===e){if(this._proposalList&&0<this._proposalList.length&&0<=this._proposalIndex&&
this._proposalIndex<this._proposalList.length)return g.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,g.ctrlKey),g.stopPropagation(),!1}else{if((40===e||38===e)&&this._proposalList&&0<this._proposalList.length)return g.preventDefault(),this._walk(40===e),g.stopPropagation(),!1;if(27===e)return g.preventDefault(),this._dismiss(),!1;if(46===e&&-1<this._proposalIndex&&this._onDelete)return g.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),g.stopPropagation(),!1}return!0};l.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};l.prototype._bind=function(g){this._dataList=g};l.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};l.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
l.prototype._initUI=function(){(this._completionUIContainer=document.getElementById(this._getUIContainerID()))||(this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer));this._completionUIContainer.textContent="";(this._completionUL=document.getElementById(this._getUIProposalListId()))||(this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL");this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};l.prototype._createProposalLink=function(g,e,d,h){var b=document.createElement("a");
b.href=require.toUrl(e);b.appendChild(this._createBoldText(g,d,h));return b};l.prototype._createBoldText=function(g,e,d,h){if(0>e)return document.createTextNode(g);h=h?h:document.createElement("span");var b;0!==e&&(b=document.createTextNode(g.substring(0,e)),h.appendChild(b));var f=document.createElement("b");h.appendChild(f);b=document.createTextNode(g.substring(e,e+d));f.appendChild(b);e+d<g.length&&(b=document.createTextNode(g.substring(e+d)),h.appendChild(b));return h};l.prototype._proposeOnCategory=
function(g,e){if(0!==e.length){var d;if(g){d=document.createElement("li");d.className="inputCompletionLICategory";var h=document.createTextNode(g);d.appendChild(h);this._completionUL.appendChild(d)}e.forEach(function(b){d=document.createElement("li");d.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);d.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);d.className="inputCompletionLINormal";d.completionItem=b.item;var e;if("string"===typeof b.item.value){var c=
document.createElement("table");c.style.width="100%";c.style.tableLayout="fixed";c.style.borderSpacing="0";var g=document.createElement("tr");g.style.width=this._inputField.offsetWidth+"px";c.appendChild(g);var a=document.createElement("td");a.classList.add("inputCompletionLILeftTD");var h=this._createBoldText(b.item.value,b.boldIndex,b.boldLength);a.appendChild(h);a.style.overflow="hidden";g.appendChild(a);this._onDelete&&(e=document.createElement("button"),e.classList.add("inputCompletionDismissButton"),
e.classList.add("layoutRight"),e.classList.add("core-sprite-close"),e.classList.add("imageSprite"),e.style.display="none",e.style.margin="0 0 0",e.title=this._deleteToolTips,e.onclick=function(a){a.stopPropagation();this._onDelete(b.item.value,this);this._resetIndexAfterDeletion()}.bind(this),a=document.createElement("td"),a.classList.add("inputCompletionLIRightTD"),a.appendChild(e),g.appendChild(a));d.appendChild(c)}else b.item.value.name&&"link"===b.item.value.type&&d.appendChild(this._createProposalLink(b.item.value.name,
b.item.value.value,b.boldIndex,b.boldLength));this._completionUL.appendChild(d);this._proposalList.push({item:b.item,domNode:d,deleteBtn:e})}.bind(this))}};l.prototype._domNode2Index=function(g){if(this._proposalList)for(var e=0;e<this._proposalList.length;e++)if(this._proposalList[e].domNode===g)return e;return-1};l.prototype._highlight=function(g,e){var d=g,h,b=!1;isNaN(d)||(b=!0,this._proposalList&&0<=g&&g<this._proposalList.length?(d=this._proposalList[g].domNode,h=this._proposalList[g].deleteBtn):
d=null);d&&(d.className=e?"inputCompletionLISelected":"inputCompletionLINormal",h&&(h.style.display=e?"":"none"),e&&b&&(d.offsetTop<this._completionUIContainer.scrollTop?d.scrollIntoView(!0):d.offsetTop+d.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&d.scrollIntoView(!1)))};l.prototype._selectProposal=function(g,e){var d=g;isNaN(d)&&(d=this._domNode2Index(g));if(d!==this._proposalIndex||e)this._highlight(this._proposalIndex,!1),this._proposalIndex=d,
this._highlight(this._proposalIndex,!0)};l.prototype._dismiss=function(g,e){this._mouseDown||(this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,"string"===typeof g?(this._inputField.value=g,this._dismissing=!0,this._inputField.focus()):g&&g.name&&"link"===g.type&&(e?window.open(g.value):window.location.href=g.value),window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200))};l.prototype._show=function(){if(this._proposalList&&0<this._proposalList.length){for(var g=
0,e=0,d=this._inputField;d;)g+=d.offsetLeft,e+=d.offsetTop,d=d.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=e+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=g+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,this._completionUIContainer.style.display="none"};l.prototype._walk=function(g){g=
this._proposalIndex+(g?1:-1);-1>g?g=this._proposalList.length-1:g>=this._proposalList.length&&(g=-1);this._selectProposal(g)};l.prototype._proposeOnList=function(g,e,d){var h="",b=[],f=e?e.length:0;g.forEach(function(c){if("category"===c.type)this._proposeOnCategory(h,b),h=c.label,b=[];else{var g=!0,a=-1;if(e&&d){var k;"string"===typeof c.value?k=c.value.toLowerCase():c.value.name&&(k=c.value.name.toLowerCase());a=k.indexOf(e);0>a?g=!1:this._proposeFromStart&&(g=0===a)}g&&b.push({item:c,boldIndex:a,
boldLength:f})}}.bind(this));this._proposeOnCategory(h,b)};l.prototype._proposeOn=function(g){this._completionUL.textContent="";var e=g?g.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,e,!0);this._extendedProvider&&e?this._extendedProvider(g,function(d){d&&d.forEach(function(d){this._proposeOnList(d.proposals,d.filterForMe?e:g,d.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};l.prototype.constructor=l;return{InputCompletion:l}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages orion/editor/find orion/commands orion/objects orion/searchUtils orion/inputCompletion/inputCompletion orion/webui/littlelib".split(" "),function(g,l,k,e,d,h,b){function f(b,d,a,e,f){l.Find.call(this,b,e,f);this._serviceRegistry=d;this._commandService=a}f.prototype=new l.Find;e.mixin(f.prototype,{getFindString:function(){var b=document.getElementById("localSearchFindWith");return!b?l.Find.prototype.getFindString.call(this):
b.value},getReplaceString:function(){var b=document.getElementById("localSearchReplaceWith");return!b?l.Find.prototype.getReplaceString(this):b.value},hide:function(){var b=this.isVisible();l.Find.prototype.hide.call(this);b&&this._commandService.closeParameterCollector()},show:function(b){l.Find.prototype.show.call(this,b);var d=b.findString;this._addRecentfind(d);b=b.replaceString;var a=document.getElementById("localSearchFindWith");a||(this._createActionTable(),a=document.getElementById("localSearchFindWith"));
d&&(a.value=d);b&&(document.getElementById("localSearchReplaceWith").value=b);window.setTimeout(function(){a.select();a.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw\x3d\x3d",this._replaceInfo.title=g["Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw\x3d\x3d",
this._replaceInfo.title=g["Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]);this._replaceInfo.style.display=""},_createActionTable:function(){var b=this;this._commandService.openParameterCollector("pageNavigationActions",function(d){var a=document.createElement("input");a.type="text";a.name=g["Find:"];a.className="parameterInput";a.id="localSearchFindWith";
a.placeholder=g["Find With"];a.oninput=function(a){return b._handleInput(a)};a.onkeydown=function(a){return b._handleKeyDown(a)};d.appendChild(a);b._initCompletion(a);b._createButton(g.Next,d,function(){b._addRecentfind(b.getFindString());b.find(!0)});b._createButton(g.Previous,d,function(){b._addRecentfind(b.getFindString());b.find(!1)});var e=b._editor.getTextView().getOptions("readonly");if(!e){var f=document.createElement("input");f.type="text";f.name=g["ReplaceWith:"];f.className="parameterInput";
f.id="localSearchReplaceWith";f.placeholder=g["Replace With"];f.onkeydown=function(a){return b._handleKeyDown(a)};d.appendChild(f);b._replaceInfo=b._createInfoImage(null,d,null);b._showReplaceInfo();b._createButton(g.Replace,d,function(){b.replace()});b._createButton(g["Replace All"],d,function(){b.replaceAll()})}f=document.createElement("div");d.appendChild(f);f.classList.add("findOptionsDiv");var h=k.createDropdownMenu(f,g.Options,null,"dismissButton",null,!0);h.menuButton.classList.add("parameterInlineButton");
k.createCheckedMenuItem(h.menu,g["Show all"],b._showAll,function(a){b.setOptions({showAll:a.target.checked});h.dropdown.close(!0)});k.createCheckedMenuItem(h.menu,g["Case sensitive"],!b._caseInsensitive,function(a){b.setOptions({caseInsensitive:!a.target.checked});h.dropdown.close(!0);b.find(!0)});k.createCheckedMenuItem(h.menu,g["Wrap search"],b._wrap,function(a){b.setOptions({wrap:a.target.checked});h.dropdown.close(!0)});k.createCheckedMenuItem(h.menu,g["Incremental search"],b._incremental,function(a){b.setOptions({incremental:a.target.checked});
h.dropdown.close(!0)});k.createCheckedMenuItem(h.menu,g["Whole Word"],b._wholeWord,function(a){b.setOptions({wholeWord:a.target.checked});h.dropdown.close(!0);b.find(!0)});b._regExBox=k.createCheckedMenuItem(h.menu,g["Regular expression"],b._regex,function(a){b.setOptions({regex:a.target.checked});h.dropdown.close(!0);b.find(!0);b._showReplaceInfo()});e||k.createCheckedMenuItem(h.menu,g["Find after replace"],b._findAfterReplace,function(a){b.setOptions({findAfterReplace:a.target.checked});h.dropdown.close(!0)});
return a},function(){b.hide()})},_storeRecentFind:function(b,d,a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){e.put("recentFind",b);d&&window.setTimeout(function(){d.dispatchEvent({type:"inputDataListChanged",deleting:a})}.bind(this),20)})},_addRecentfind:function(b){"string"===typeof b&&b&&(!this._completion||!this._completion.hasValueOf(b))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var a;
d=d.get("recentFind");"string"===typeof d&&(d=JSON.parse(d));if(d){for(a in d)if(d[a].name===b)return;30<=d.length&&d.splice(29,d.length-30+1)}else d=[];d.splice(0,0,{name:b});this._storeRecentFind(d,this._completion)}.bind(this))},_removeRecentSearch:function(b,d){"string"===typeof b&&b&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var e;a=a.get("recentFind");"string"===typeof a&&(a=JSON.parse(a));if(a)for(e in a)if(a[e].name===b){a.splice(e,
1);this._storeRecentFind(a,d,!0);break}}.bind(this))},_initCompletion:function(b){if(this._completion)this._completion.setInputField(b);else{var d=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get("recentFind");"string"===typeof b&&(b=JSON.parse(b));if(b){var c=[];b.forEach(function(a){c.push({type:"proposal",label:a.name,value:a.name})});a(c)}})}.bind(this);this._completion=new h.InputCompletion(b,d,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,b){this._removeRecentSearch(a,b)}.bind(this),deleteToolTips:g["Click or use delete key to delete the search term"]})}},_createButton:function(c,d,a){var e=document.createElement("button");e.addEventListener("click",a.bind(this),!1);var f=this;e.addEventListener("keydown",function(a){a.keyCode===b.KEY.ESCAPE&&f.hide()});e.appendChild(document.createTextNode(c));e.className="dismissButton parameterInlineButton";d.appendChild(e)},_createInfoImage:function(b,d,
a){b=document.createElement("img");b.classList.add("replaceInfo");b.addEventListener("click",function(a){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));d.appendChild(b);return b},_handleInput:function(b){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(b){var d=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;return d&&70===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=
!0,!1):(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&75===b.keyCode||13===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this._addRecentfind(this.getFindString()),13===b.keyCode?this.find(this._reverse?b.shiftKey:!b.shiftKey):this.find(!b.shiftKey),!1):d&&82===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.replace(),!1):27===b.keyCode?(this.hide(),!1):!0}});return{TextSearcher:f}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(g){var l=Object.create(null);g.getServiceReferences("orion.edit.context").forEach(function(k){var e=g.getService(k);Object.keys(e).forEach(function(d){"function"===typeof e[d]&&(l[d]=e[d].bind(e))})});return l},getOptions:function(g){var l=Object.create(null);g.getServiceReferences("orion.edit.context").forEach(function(g){g.getPropertyKeys().forEach(function(e){"service.id"!==e&&"service.names"!==e&&"objectClass"!==
e&&(l[e]=g.getProperty(e))})});return l}}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate","orion/edit/editorContext"],function(g,l,k,e){function d(d,b){for(var e=b.getFileMetadata(),c=d.getServiceReferences("orion.edit.blamer"),k=0;k<c.length;k++){var a=c[k],l={};l.validationProperties=a.getProperty("validationProperties");l.forceSingleItem=!0;l=g._makeValidator(l,d);if(l.validationFunction.bind(l)(e))return d.getService(a)}return null}return{isVisible:function(e,b){return!!d(e,b)&&!!e.getService("orion.core.blame")},
getBlame:function(g,b){var f=d(g,b);if(f){var c=function(a){for(var b=l.getOrionHome(),c=0;c<a.length;c++){var d=a[c],e=new k(d.CommitLink),f={};f.OrionHome=b;d.CommitLink=e.expand(f)}g.getService("orion.core.blame")._setAnnotations(a)};if(f.computeBlame){var m={metadata:b.getFileMetadata()};f.computeBlame(e.getEditorContext(g),m).then(c)}else f.doBlame(b.getInput()).then(c)}}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages orion/i18nUtil orion/webui/littlelib orion/webui/dialogs/OpenResourceDialog orion/widgets/input/DropDownMenu orion/Deferred orion/URITemplate orion/commands orion/keyBinding orion/commandRegistry orion/extensionCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/PageLinks orion/editor/annotations orion/blamer orion/regex orion/util orion/edit/editorContext".split(" "),function(g,l,k,e,d,h,b,f,c,m,a,n,q,s,t,y,u,v,x,z){function A(a){var c=
new b(a.uriTemplate),d=a.params||{};d.OrionHome=d.OrionHome||t.getOrionHome();var c=c.expand(d),e=document.createElement("div"),f=document.createElement("iframe");f.id=a.id;f.name=a.id;f.type="text/html";f.sandbox="allow-scripts allow-same-origin";f.frameborder=void 0!==a.border?a.border:1;f.src=c;f.className="delegatedUI";a.width&&(e.style.width=a.width,f.style.width=a.width);a.height&&(e.style.height=a.height,f.style.height=a.height);f.style.visibility="hidden";null!==a.parent&&(a.parent||window.document.body).appendChild(e);
e.appendChild(f);f.style.left=a.left||(window.innerWidth-parseInt(f.clientWidth,10))/2+"px";f.style.top=a.top||(window.innerHeight-parseInt(f.clientHeight,10))/2+"px";f.style.visibility="";window.addEventListener("message",function E(b){if(b.source===f.contentWindow&&"string"===typeof b.data&&(b=JSON.parse(b.data),"orion.page.delegatedUI"===b.pageService&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",E,!1);e.parentNode&&e.parentNode.removeChild(e)}},!1);return e}function C(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var p={},w=null;p.createDelegatedUI=A;C.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(a){var b=this,e=new f.Command({imageClass:"core-sprite-wrench",tooltip:g.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return a.installed},callback:function(c){var f=e.settingsDropDown;if(!f||
f.isDestroyed())f=e.settingsDropDown=new d(c.domNode.parentNode,c.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){f.focus()},onHide:function(){a.focus()}}),f.updateContent=b.localSettings.show.bind(b.localSettings),c=f.getContentNode(),c.tabIndex=c.style.marginTop=0;f.click()}});this.commandService.addCommand(e);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new c.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){var b=
new f.Command({name:g.Undo,id:"orion.undo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().undo()}});this.commandService.addCommand(b);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new c.KeyBinding("z",!0));b=new f.Command({name:g.Redo,id:"orion.redo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().redo()}});
this.commandService.addCommand(b);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,x.isMac?new c.KeyBinding("z",!0,!0):new c.KeyBinding("y",!0))},_generateSearchFilesCommand:function(a){var b=this;if(b._searcher){var d=!1,h=new f.Command({name:g.searchFiles,tooltip:g.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return a.installed},callback:function(c){if(!d){c=
a.getSelection();c=a.getText(c.start,c.end);var f=b.serviceRegistry.getService("orion.page.progress"),h=new e.OpenResourceDialog({searcher:b._searcher,progress:f,searchRenderer:b._searcher.defaultRenderer,nameSearch:!1,title:g.searchFiles,message:g.searchTerm,initialText:c,onHide:function(){d=!1;a.focus()}});window.setTimeout(function(){d=!0;h.show(k.node(b.toolbarId))},0)}}});this.commandService.addCommand(h);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",
1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new c.KeyBinding("h",!0))}},_generateSaveCommand:function(a,b){var d=this,e=b?b:"orion.save",h=new f.Command({name:g.Save,tooltip:g.saveFile,id:e,visibleWhen:function(){return!a.installed||d.inputManager.getReadOnly()?!1:!0},callback:function(a){d.inputManager.save();return!0}});this.commandService.addCommand(h);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,e,1,this.saveToolbarId?
"orion.menuBarFileGroup/orion.saveGroup":null,!1,new c.KeyBinding("s",!0));a.getTextView&&a.getTextView()&&(a.getTextView().setKeyBinding(new c.KeyBinding("s",!0),"save"),a.getTextView().setAction("save",h.callback,h))},_generateGotoLineCommnand:function(a){var b=this,d=new m.ParametersDescription([new m.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+1;return[new m.CommandParameter("line","number","Line:",b.toString())]}),
d=new f.Command({name:g.gotoLine,tooltip:g.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return a.installed},parameters:d,callback:function(b){var c=a.getModel();b.parameters&&b.parameters.valueFor("line")?b=b.parameters.valueFor("line"):(b=c.getLineAtOffset(a.getCaretOffset()),(b=prompt(g.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(d);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",
3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new c.KeyBinding("l",!x.isMac,!1,!1,x.isMac),new m.URLBinding("gotoLine","line"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("gotoLine",function(c){if(c)return a.onGotoLine(c.line-1,0,void 0,c.callback),!0;b.commandService.runCommand("orion.gotoLine");return!0},d)},_generateFindCommnand:function(a){var b=this,d=new m.ParametersDescription([new m.CommandParameter("find","text","Find:")],{clientCollect:!0},
function(){var c=a.getSelection(),d="";c.end>c.start&&(d=a.getModel().getText(c.start,c.end),b._localSearcher&&b._localSearcher.getOptions().regex&&(d=v.escape(d)));return[new m.CommandParameter("find","text","Find:",d)]}),d=new f.Command({name:g.Find,tooltip:g.Find,id:"orion.editor.find",visibleWhen:function(){return a.installed},parameters:d,callback:function(c){if(b._localSearcher){var d="",e=null,f=a.getSelection();f.end>f.start&&c.parameters.valueFor("useEditorSelection")?(d=a.getModel().getText(f.start,
f.end),b._localSearcher.getOptions().regex&&(d=v.escape(d))):c.parameters&&c.parameters.valueFor("find")&&(d=c.parameters.valueFor("find"),e=s.matchResourceParameters(),q.convertFindURLBinding(e));e?(b._localSearcher.setOptions({regex:e.regEx,caseInsensitive:!e.caseSensitive}),c={},e.atLine&&(c.start=a.getModel().getLineStart(e.atLine-1)),b._localSearcher.show({findString:d,replaceString:e.replaceWith}),b._localSearcher.find(!0,c)):b._localSearcher.show({findString:d});return!0}return!1}});this.commandService.addCommand(d);
this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new c.KeyBinding("f",!0),new m.URLBinding("find","find"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("find",function(a){if(a)return b._localSearcher.show(a),!0;b.commandService.runCommand("orion.editor.find",null,null,new m.ParametersDescription([new m.CommandParameter("useEditorSelection","text",
"","true")],{clientCollect:!0}));return!0},d)},_generateBlame:function(a){var b=this,d=new f.Command({name:g.Blame,tooltip:g.BlameTooltip,id:"orion.edit.blame",parameters:new m.ParametersDescription([new m.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.installed?!1:u.isVisible(b.serviceRegistry,b.inputManager)},callback:function(c){for(var d=!1,e=a.getAnnotationModel().getAnnotations();e.hasNext();)if(e.next().type===y.AnnotationType.ANNOTATION_BLAME){d=!0;
break}d=!d;c.parameters&&c.parameters.valueFor("blame")&&(d="true"===c.parameters.valueFor("blame"));d?u.getBlame(b.serviceRegistry,b.inputManager):a.showBlame([])}});this.commandService.addCommand(d);this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new c.KeyBinding("b",!0,!0),new m.URLBinding("blame","blame"))},_generateEditCommands:function(b){function d(a){if(!a)return null;var b=new c.KeyBinding;c.KeyBinding.apply(b,a);return b}function e(a,
b){!b&&a&&"undefined"!==typeof a.HTML&&delete a.HTML;var c=m.serviceRegistry.getService("orion.page.message");c?c.setProgressResult(a):window.console.log(a)}var m=this,p=this.toolbarId,q=this.serviceRegistry,s=q.getServiceReferences("orion.edit.command"),v=this.inputManager,u=q.getService("orion.page.progress"),x=function(a,c,d){var h=d.visibleWhen;d.visibleWhen=function(a){return!b.installed||m.inputManager.getReadOnly()?!1:!h||h(a)};d.callback=function(d){b=this;var f=b.getSelection?b.getSelection():
{start:0,end:0};d=b.getModel();var h=function(a){"object"===typeof a&&a?(a.text&&b.setText(a.text),a.selection&&(b.setSelection&&b.setSelection(a.selection.start,a.selection.end,!0),b.focus())):"string"===typeof a&&(b.setText(a,f.start,f.end,!0),b.setSelection&&b.setSelection(f.start,f.start+a.length),b.focus())},k;c.execute?(d={contentType:v.getContentType(),input:v.getInput()},k=z.getEditorContext(q),k.openDelegatedUI=A,k.setStatus=e,d=c.execute(k,d),k=null):(d=c.run(d.getText(f.start,f.end),d.getText(),
f,v.getInput()),k=function(b){if(b&&b.uriTemplate){var c={};c.uriTemplate=b.uriTemplate;c.params=v.getFileMetadata();c.id=a.id;c.width=b.width;c.height=b.height;c.done=h;c.status=e;A(c)}else b&&(b.Status||b.status)?e(b.Status||b.status):h(b)});u.showWhile(d,l.formatMessage(g.running,a.name)).then(k);return!0};d.callback=d.callback.bind(b);return new f.Command(d)};h.when(function(a){if(w)return w;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new n.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));
return b.getContentTypes().then(function(a){return w=a})}(this.serviceRegistry),function(){var c=[],e=100;s.forEach(function(f){var g=f.getProperty("editor");if(!g||!(b.id&&g!==b.id)){for(var h=m.serviceRegistry.getService(f),k={},g=f.getPropertyKeys(),l=0;l<g.length;l++)k[g[l]]=f.getProperty(g[l]);k.forceSingleItem=!0;f=a._createCommandOptions(k,f,m.serviceRegistry,w,!1,function(a){return v.getFileMetadata()});c.push(f);f.then(function(a){a=x(k,h,a);m.commandService.addCommand(a);m.commandService.registerCommandContribution(m.toolbarId,
a.id,e,"orion.menuBarToolsGroup",!1,d(k.key))});e++}});h.all(c,function(a){return{_error:a}}).then(function(a){if(a=v.getFileMetadata()){var c=k.node(p);c&&(m.commandService.destroy(c),m.commandService.renderCommands(c.id,c,a,b,"button"));if(c=k.node("pageNavigationActions"))m.commandService.destroy(c),m.commandService.renderCommands(c.id,c,b,b,"button")}})})}};p.EditorCommandFactory=C;return p});
define("orion/inputManager","i18n!orion/edit/nls/messages orion/explorers/navigatorRenderer orion/i18nUtil orion/Deferred orion/EventTarget orion/objects orion/PageUtil".split(" "),function(g,l,k,e,d,h,b){function f(a){this._document=a.document||document;this._timeout=a.timeout;a="keypress keydown keyup mousemove mousedown mousemove".split(" ");for(var b=function(a){this._resetTimer()}.bind(this),c=0;c<a.length;c++)this._document.addEventListener(a[c],b,!0);d.attach(this)}function c(a,b){if(a){if(!b.Severity){var c=
b,d={Severity:"Error",Message:g.noResponse};if(0!==c.status)if(c.responseText){c=c.responseText;try{var e=JSON.parse(c);d.Severity=e.Severity||d.Severity;d.Message=e.Message||d.Message}catch(f){d.Message=c}}else try{d.Message=JSON.stringify(c)}catch(h){}b=d}a.setProgressResult(b)}else window.console.log(b)}function m(a){d.attach(this);this.serviceRegistry=a.serviceRegistry;this.statusService=a.statusService;this.fileClient=a.fileClient;this.progressService=a.progressService;this.contentTypeRegistry=
a.contentTypeRegistry;this.selection=a.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}f.prototype={_resetTimer:function(){var a=this._document.defaultView||this._document.parentWindow;this._timer&&(a.clearTimeout(this._timer),this._timer=null);-1!==this._timeout&&(this._timer=a.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout))},onIdle:function(a){return this.dispatchEvent(a)},setTimeout:function(a){this._timeout=
a;this._resetTimer()}};h.mixin(m.prototype,{_maybeLoadWorkspace:function(a){var b=this.fileClient;return a===b.fileServiceRootURL(a)?b.loadWorkspace(a).then(function(a){return a.Location}):(new e).resolve(a)},_read:function(a){var b=this.cachedMetadata||l.getClickedItem();if(b&&b.Location===a&&b.Parents&&b.Attributes&&b.ETag)return(new e).resolve(b);var c=this.fileClient,d=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(a).then(function(a){return c.read.apply(c,[a].concat(d))})},
load:function(){var a=this.getInput();if(a){var b=this.fileClient,d=this._parsedLocation.resource,f=this.progressService,h=function(a,b,c){return!f?a:f.progress(a,k.formatMessage(b,c))},m=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&h(b.read(d,!0),g.ReadingMetadata,a).then(function(c){this._fileMetadata&&this._fileMetadata.Location===c.Location&&this._fileMetadata.ETag!==c.ETag&&(this._fileMetadata=c,(!m.isDirty()||window.confirm(g.loadOutOfSync))&&
h(b.read(d),g.Reading,a).then(function(b){m.setInput(a,null,b);this._unsavedChanges=[]}.bind(this)))}.bind(this));else{var l=d;if(0===l.indexOf("/gitapi/commit/")){var v=l.indexOf("/file"),x=l.indexOf("?",v);-1===x&&(x=l.length);l=l.substring(v,x);this._readonly=!0}var z=window.setTimeout(function(){z=null;this.reportStatus(k.formatMessage(g.Fetching,a))}.bind(this),800),A=function(){this.reportStatus("");z&&window.clearTimeout(z)}.bind(this),C=function(a){A();var b=null;this.serviceRegistry?b=this.serviceRegistry.getService("orion.page.message"):
this.statusService&&(b=this.statusService);c(b,a);this._setNoInput()}.bind(this);this._acceptPatch=null;h(this._read(l,!0),g.ReadingMetadata,l).then(function(c){c?c.Directory?e.when(c.Children||h(b.fetchChildren(c.ChildrenLocation),g.Reading,a),function(b){A();c.Children=b;this._setInputContents(this._parsedLocation,a,b,c)}.bind(this),C):this._isText(c)?h(b.read(d,!1,!0),g.Reading,a).then(function(b){A();"string"!==typeof b&&(this._acceptPatch=b.acceptPatch,b=b.result);this._setInputContents(this._parsedLocation,
a,b,c)}.bind(this),C):h(b._getService(d).readBlob(d),g.Reading,a).then(function(b){A();this._setInputContents(this._parsedLocation,a,b,c)}.bind(this),C):C({responseText:k.formatMessage(g.ReadingMetadataError,l)})}.bind(this),C)}}},processParameters:function(a){var b=this.getEditor();b&&b.processParameters&&b.processParameters(a)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var a=this._fileMetadata;return this._readonly||!a||a.Attributes&&a.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(a){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(a){if(this._getSaveDiffsEnabled()){var b=this._unsavedChanges.length,c=a.removedCharCount,d=a.start,e=a.start+c,f=
0;0===a.addedCharCount?f=-1:0===c&&(f=1);if(0<b&&f===this.previousChangeType){b=this._unsavedChanges[b-1];if(0===c&&d===b.end+b.text.length){b.text+=a.text;return}if(0===a.addedCharCount&&e===b.start){b.start=d;return}}this.previousChangeType=f;this._unsavedChanges.push({start:d,end:e,text:a.text})}},reportStatus:function(a){this.statusReporter?this.statusReporter(a):this.editor&&this.editor.reportStatus(a)},save:function(){function a(a){f===w.getInput()&&(w.getFileMetadata().ETag=a.ETag,d.setInput(f,
null,h,!0));w.reportStatus("");e&&p&&p.setProgressResult({Message:g.Saved,Severity:"Normal"});w.afterSave&&w.afterSave();w._saving=!1}function b(a){w.reportStatus("");c(p,a);w._saving=!1;w._errorSaving=!0}if(!this._saving){var d=this.getEditor();if(d&&d.isDirty()&&!this.getReadOnly()){var e=this._errorSaving;this._saving=!0;var f=this.getInput();this.reportStatus(g["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});d.markClean();var h=d.getText(),m=h;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var l=this._unsavedChanges,x=0,z=0;z<l.length;z++)x+=l[z].text.length;h.length>x&&(m={diff:l})}this._unsavedChanges=[];this._errorSaving=!1;var l={ETag:this.getFileMetadata().ETag},A=this._parsedLocation.resource,m=this.fileClient.write(A,m,l),C=this.progressService,p=null;this.serviceRegistry&&(p=this.serviceRegistry.getService("orion.page.message"));C&&(m=C.progress(m,k.formatMessage(g.savingFile,f)));var w=this;m.then(a,function(c){412===c.status?window.confirm(g.saveOutOfSync)?
(c=w.fileClient.write(A,h),C&&(c=C.progress(c,k.formatMessage(g.savingFile,f))),c.then(a,b)):w._saving=!1:b(c)})}}},setAutoLoadEnabled:function(a){this._autoLoadEnabled=a},setAutoSaveTimeout:function(a){this._autoSaveEnabled=-1!==a;this._idle?this._idle.setTimeout(a):(this._idle=new f({document:document,timeout:a}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(a){this._contentType=a},setInput:function(a){if(!this._ignoreInput&&
(a||(a=b.hash()),"string"===typeof a)){var c=this.getEditor();a&&"#"!==a[0]&&(a="#"+a);var d=b.matchResourceParameters(a),e=this._parsedLocation||{};if(c&&c.isDirty()){var f=this._location;if(e.resource!==d.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(g.confirmUnsavedChanges)){window.location.hash=f;return}}c=c&&e.editor!==d.editor;this._location=a;this._parsedLocation=d;this._ignoreInput=!0;this.selection&&this.selection.setSelections(a);this._ignoreInput=!1;(a=d.resource)?
a===this._input?c?(this.reportStatus(""),this._setInputContents(d,a,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(d):(this._input=a,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(a){var b=a.lastIndexOf("/");-1!==b&&(a=a.substring(b+1));this._title=a},setSaveDiffsEnabled:function(a){this._saveDiffsEnabled=a},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&null!==this._acceptPatch&&-1!==this._acceptPatch.indexOf("application/json-patch")},
_isText:function(a){a=this.contentTypeRegistry.getFileContentType(a);if(!a)return!0;var b=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(a,b)},_setNoInput:function(a){a?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),this.dispatchEvent({type:"InputChanged",input:null}))},_setInputContents:function(a,
b,c,d,e){var f,g=!1;d?(this._fileMetadata=d,this.setTitle(d.Location||String(d)),this.setContentType(this.contentTypeRegistry.getFileContentType(d)),f=d.Name,g=d.Directory):(this._fileMetadata=null,this.setTitle(b),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),f=this.getTitle());var h=this.getEditor();this._focusListener&&(h&&h.getTextView&&h.getTextView()&&h.getTextView().removeEventListener("Focus",this._focusListener),this._focusListener=null);this._changingListener&&
(h&&h.getModel&&h.getModel()&&h.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null);d={type:"InputChanged",input:a,name:f,title:b,contentType:this.getContentType(),metadata:d,location:window.location,contents:c};this.dispatchEvent(d);this.editor=h=d.editor;g||(h&&h.getModel&&h.getModel()&&h.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this)),e||h.setInput(b,null,c),h&&h.getTextView&&h.getTextView()&&h.getTextView().addEventListener("Focus",
this._focusListener=this.onFocus.bind(this)),this._unsavedChanges=[],this.processParameters(a))}});return{handleError:c,InputManager:m}});
define("orion/compare/resourceComparer","i18n!orion/compare/nls/messages require orion/Deferred orion/webui/littlelib orion/compare/compareUtils orion/compare/diffProvider orion/compare/compareView orion/highlight orion/fileClient orion/globalCommands orion/commands orion/keyBinding orion/searchAndReplace/textSearcher orion/editorCommands orion/objects orion/inputManager orion/editor/editorFeatures orion/URL-shim".split(" "),function(g,l,k,e,d,h,b,f,c,m,a,n,q,s,t,y,u){function v(a){this._syntaxHighlither=
new f.SyntaxHighlighter(a)}l={};l.DefaultDiffProvider=function(){function a(b){this.serviceRegistry=b;this._diffProvider=new h.DiffProvider(b)}a.prototype={_resolveTwoFiles:function(a,b){var c=this;return k.all([c._getContentType(a),c._getContentType(b)],function(a){return{_error:a}}).then(function(d){if(Array.isArray(d)&&2===d.length&&d[0]&&d[1]){var e=d[0];d=d[1];return(new k).resolve({oldFile:{URL:a,Name:c._resolveFileName(a),Type:e},newFile:{URL:b,Name:c._resolveFileName(b),Type:d},diffContent:c._diffContent})}e=
a?c._resolveFileName(a):"";d=b?c._resolveFileName(b):"";return(new k).resolve({oldFile:{URL:a,Name:e,Type:null},newFile:{URL:b,Name:d,Type:null},diffContent:c._diffContent})})},_resolveFileName:function(a){return a.split("?")[0]},_getContentType:function(a){a=this._resolveFileName(a);return this.serviceRegistry.getService("orion.core.contentTypeRegistry").getFilenameContentType(a)},_resolveComplexFileURL:function(a){var b=this;return this._diffProvider.getDiffFileURI(a).then(function(a,c){return b._resolveTwoFiles(a.Old,
a.New)},function(){})},resolveDiff:function(a,b,c){this._hasConflicts=c;if(b)return this._resolveTwoFiles(b,a);if(this._diffProvider){var d=this;return d._diffProvider.getDiffContent(a).then(function(b,c){d._diffContent=d._hasConflicts?b.split("diff --git")[1]:b;return d._resolveComplexFileURL(a)},function(){})}console.log("A diff provider is needed for compound diff URL")}};return a}();v.prototype={highlight:function(a,b,c){return this._syntaxHighlither.setup(b,c.getTextView(),null,a,!1)}};l.ResourceComparer=
function(){function f(a,d,e,h){this._registry=a;this._commandService=d;this._fileClient=new c.FileClient(a);this._fileClient=new c.FileClient(a);this._searchService=this._registry.getService("orion.core.search");this._progress=this._registry.getService("orion.page.progress");this.setOptions(e,!0);this._compareView=e.toggleable?new b.toggleableCompareView("inline"===e.type?"inline":"twoWay",h):"inline"===e.type?new b.inlineCompareView(h):new b.TwoWayCompareView(h);this._compareView.getWidget().setOptions({extCmdHolder:this});
h.highlighters||this._compareView.getWidget().setOptions({highlighters:[new v(a),new v(a)]});h.oldFile||this._compareView.getWidget().setOptions({oldFile:{readonly:this._checkReadonly(e.readonlyRight)}});h.newFile||this._compareView.getWidget().setOptions({newFile:{readonly:this._checkReadonly(e.readonly,!0)}});this.initExtCmds();this._initInputManagers();this._compareView.getWidget().initEditors(g["fetching..."]);this._inputManagers.forEach(function(a){if(a.manager){var b=this._compareView.getWidget().getEditors()[a.manager._editorIndex];
b.addEventListener("DirtyChanged",function(c){a.manager.setDirty(b.isDirty())})}}.bind(this))}f.prototype={_clearOptions:function(){this.options={}},_checkReadonly:function(a,b){return b?"undefined"===typeof a?!1:a:"undefined"===typeof a?!0:a},_getFileOptions:function(a){return 1===a?this._compareView.getWidget().options.newFile:this._compareView.getWidget().options.oldFile},_createInputManager:function(){return new y.InputManager({serviceRegistry:this._registry,fileClient:this._fileClient,progressService:this._progress})},
_initInputManagers:function(){this._inputManagers=[{},{}];!this.options.toggleable&&this._compareView.getWidget()._uiFactory&&"twoWay"===this._compareView.getWidget().type&&(this._checkReadonly(this.options.readonlyRight)||(this._inputManagers[0].manager=this._createInputManager(),this._initInputManager(this._inputManagers[0].manager,0,this._compareView.getWidget()._uiFactory.getActionDivId())),this._checkReadonly(this.options.readonly,!0)||(this._inputManagers[1].manager=this._createInputManager(),
this._initInputManager(this._inputManagers[1].manager,1,this._compareView.getWidget()._uiFactory.getActionDivId(!0))));var a=this;this._inputManagers.forEach(function(b){b.manager&&(this._getFileOptions(b.manager._editorIndex).keyBindingFactory=function(c,d,e,f){d=new q.TextSearcher(c,a._registry,a._commandService,e);e=(new u.KeyBindingsFactory).createKeyBindings(c,e,f,d);(new s.EditorCommandFactory({serviceRegistry:a._registry,commandRegistry:a._commandService,fileClient:a._fileClient,inputManager:b.manager,
toolbarId:b.manager._actionBarId,readonly:!1,navToolbarId:"pageNavigationActions",textSearcher:d})).generateSimpleEditorCommands(c,1===b.manager._editorIndex?"orion.compare.save.left":"orion.compare.save.right");return e})}.bind(this))},_initInputManager:function(a,b,c){var d=this;t.mixin(a,{filePath:"",_editorIndex:b,_actionBarId:c,getInput:function(){return this.filePath},setDirty:function(a){var b=d._compareView.getWidget().getEditors(),c=a;b&&2===b.length&&(c=b[0].isDirty()||b[1].isDirty());m.setDirtyIndicator(c);
d._compareView.getWidget().refreshTitle&&d._compareView.getWidget().refreshTitle(this._editorIndex,a)},getFileMetadata:function(){return this._fileMetadata},getEditor:function(){return d._compareView.getWidget().getEditors()[this._editorIndex]},setInput:function(a,b){this._parsedLocation={resource:a};d._progress.progress(d._fileClient.read(a,!0),"Getting file metadata "+a).then(function(a){this._fileMetadata=a;var b=e.node(this._actionBarId);if(b){d._commandService.destroy(b);var c=this._editorIndex;
d._commandService.renderCommands(b.id,b,d._compareView.getWidget().getEditors()[c],d._compareView.getWidget().getEditors()[c],"button")}a&&this.setTitle(a.Location,a)}.bind(this),function(b){console.error("Error loading file metadata: "+b.message);this.setTitle(a)}.bind(this));this.lastFilePath=a},setTitle:function(a,b){"*"===a.charAt(0)?m.setDirtyIndicator(!0):m.setDirtyIndicator(!1)},afterSave:function(){var a=d._compareView.getWidget().getEditors()[this._editorIndex].getTextView().getText();d._getFileOptions(this._editorIndex).Content=
a;d._compareView.getWidget().refresh()}})},setOptions:function(a,b){b&&this._clearOptions();this.options||(this.options={});a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this))},generateLink:function(a){a=a.getCurrentDiffPos();a=d.generateCompareHref(this.options.resource,{compareTo:this.options.compareTo,readonly:this.options.readonly,readonlyRight:this.options.readonlyRight,conflict:this.options.hasConflicts,block:a.block?a.block:1,change:a.change?a.change:0});a=(new URL(a,window.location.href)).href;
prompt(g["Copy the link URL:"],a)},openComparePage:function(a){a=a.getCurrentDiffPos();return d.generateCompareHref(this.options.resource,{compareTo:this.options.compareTo,readonly:!this.options.editableInComparePage,conflict:this.options.hasConflicts,block:a.block?a.block:1,change:a.change?a.change:0})},initExtCmds:function(){var b=this._compareView.getWidget().options.commandProvider;if(b&&b.getOptions().commandSpanId){var b=b.getOptions().commandSpanId,c=new a.Command({tooltip:g["Generate link of the current diff"],
name:g["Generate Link"],id:"orion.compare.generateLink",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.extCmdHolder.options.resource&&a.options.extCmdHolder.options.generateLink},callback:function(a){a.items.options.extCmdHolder.generateLink(a.items)}}),d=new a.Command({tooltip:g["Open the compare page"],name:g.Compare,id:"orion.compare.openComparePage",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.extCmdHolder.options.resource&&!a.options.extCmdHolder.options.generateLink},
hrefCallback:function(a){return a.items.options.extCmdHolder.openComparePage(a.items)}});this._commandService.addCommand(c);this._commandService.addCommand(d);this._commandService.registerCommandContribution(b,"orion.compare.openComparePage",98);this._commandService.registerCommandContribution(b,"orion.compare.generateLink",99,null,!1,new n.KeyBinding("l",!0,!0))}},_getFilesContents:function(a){var b=[];a.forEach(function(a){b.push(this._loadSingleFile(a))}.bind(this));return k.all(b,function(a){return{_error:a}})},
_isImage:function(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1},_loadSingleFile:function(a){return this._registry.getService("orion.page.progress").progress(this._fileClient.read(a.URL),"Getting contents of "+a.URL).then(function(b){a.Content=b;return a}.bind(this),function(b,c){404===b.status&&(a.Content="");return a}.bind(this))},start:function(){if(this.options.resource){if(this.options.diffProvider){var a=
this;return a.options.diffProvider.resolveDiff(a.options.resource,a.options.compareTo,a.options.hasConflicts).then(function(b){a._compareView.getWidget().setOptions(b);b=a._isImage(b.newFile.Type);var c=a._compareView.getWidget().options;if(a._checkReadonly(a.options.readonlyRight)||b)c.oldFile.readonly=!0;if(a._checkReadonly(a.options.readonly,!0)||b)c.newFile.readonly=!0;return b?(a._compareView.initImageMode(),a._compareView.getWidget().refresh().then(function(a){return(new k).resolve(a+5)})):
a._getFilesContents(c.diffContent?[c.oldFile]:[c.oldFile,c.newFile]).then(function(){var b=a._compareView.getWidget().refresh(!0);this._inputManagers.forEach(function(b){if(b.manager){var c=a._getFileOptions(b.manager._editorIndex),d=a._compareView.getWidget().getEditors()[b.manager._editorIndex];b.manager.filePath=c.URL;b.manager.setInput(c.URL,d)}});return(new k).resolve(b)}.bind(a))})}console.log("A diff provider is needed for Complex diff URL")}}};return f}();return l});
define("orion/git/uiUtil",["orion/compare/compareCommands","orion/compare/resourceComparer","orion/webui/littlelib","orion/git/util"],function(g,l,k,e){e=Object.create(e);e.createCompareWidget=function(d,e,b,f,c,m,a,n,q){var s=new l.DefaultDiffProvider(d);m=new g.CompareCommandFactory({commandService:e,commandSpanId:m,gridRenderer:n});(new l.ResourceComparer(d,e,{toggleable:!0,type:"inline",readonly:!0,hasConflicts:f,diffProvider:s,resource:b,compareTo:q,editableInComparePage:a},{parentDivId:c,commandProvider:m})).start().then(function(a){var b=
420;a<b&&(b=a);k.node(c).style.height=b+"px"})};return e});
define("orion/git/gitCommitExplorer","require i18n!git/nls/gitmessages orion/section orion/explorers/explorer orion/URITemplate orion/PageUtil orion/i18nUtil orion/webui/littlelib orion/globalCommands orion/git/gitCommands orion/git/uiUtil orion/Deferred orion/webui/tooltip".split(" "),function(g,l,k,e,d,h,b,f,c,m,a,n,q){n={};var s=new d("git/git-repository.html#{,resource,params*}"),t=new d("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1");n.GitCommitExplorer=function(){function d(a,
b,c,f,g,h,k,m){this.parentId=g;this.registry=a;this.commandService=b;this.linkService=c;this.selection=f;this.parentId=g;this.toolbarId=h;this.selectionToolsId=k;this.checkbox=!1;this.actionScopeId=m;e.createExplorerCommands(b)}d.prototype.handleError=function(a){var b={Severity:"Error",HTML:!1};try{var c=JSON.parse(a.responseText);b.Message=c.DetailedMessage?c.DetailedMessage:c.Message}catch(d){b.Message=a.message}this.registry.getService("orion.page.message").setProgressResult(b);404===a.status&&
(this.initTitleBar(),this.displayCommit())};d.prototype.changedItem=function(a,b){this.redisplay()};d.prototype.redisplay=function(){var a=h.matchResourceParameters();this.display(a.resource)};d.prototype.display=function(a){var b=this,c=this.registry.getService("orion.page.progress");c.showWhile(this.registry.getService("orion.git.provider").getGitClone(a),"Getting repository details").then(function(a){if(0===a.Children.length)b.initTitleBar(),b.displayCommit();else if(1===a.Children.length&&"Commit"===
a.Children[0].Type){var d=a.Children;c.progress(b.registry.getService("orion.git.provider").getGitClone(a.CloneLocation),"Getting repository details "+a.Name).then(function(a){a=a.Children;b.initTitleBar(d[0],a[0]);b.displayCommit(d[0]);b.displayTags(d[0]);b.displayDiffs(d[0]);d[0].CloneLocation=a[0].Location;m.updateNavTools(b.registry,b.commandService,b,"pageActions","selectionTools",d[0])},function(a){b.handleError(a)})}},function(a){b.handleError(a)})};d.prototype.initTitleBar=function(a,b){var d=
{};a.GitUrl=b.GitUrl;a.ContentLocation=b.ContentLocation;a&&(d={},d.Name=a.Name,d.Parents=[],d.Parents[0]={},d.Parents[0].Name=b.Name,d.Parents[0].Location=b.Location,d.Parents[0].ChildrenLocation=b.Location,d.Parents[1]={},d.Parents[1].Name=l.Repositories);c.setPageTarget({task:"Commit",target:a,breadcrumbTarget:d,makeBreadcrumbLink:function(a,b){a.href=g.toUrl(s.expand({resource:b||""}))},serviceRegistry:this.registry,commandService:this.commandService})};d.prototype.displayCommit=function(a){var c=
f.node("table");f.empty(c);if(a){var d=document.createElement("div");d.className="sectionTable";c.appendChild(d);c=document.createElement("div");c.className="mainPadding";c.id="commitNode";d.appendChild(c);d=document.createElement("div");d.className="sectionTableItem";c.appendChild(d);var c=this._splitCommitMessage(a.Message),e=document.createElement("div");e.style.paddingBottom="15px";this.registry.getService("orion.core.textlink").addLinks(c[0],e);d.appendChild(e);null!==c[1]&&(e=document.createElement("pre"),
e.style.paddingBottom="15px",e.style.marginTop="0px",this.registry.getService("orion.core.textlink").addLinks(c[1],e),d.appendChild(e));c=document.createElement("div");c.appendChild(document.createTextNode(b.formatMessage(l["commit: 0"],a.Name)));d.appendChild(c);a.Parents&&0<a.Parents.length&&(c=document.createElement("div"),c.style.paddingBottom="15px",e=document.createElement("a"),e.className="pnavlinkonpage",e.href=g.toUrl(t.expand({resource:a.Parents[0].Location})),e.textContent=b.formatMessage(l["parent: 0"],
a.Parents[0].Name),c.appendChild(e),d.appendChild(c));a.AuthorImage&&(c=document.createElement("div"),c.style["float"]="left",e=new Image,e.src=a.AuthorImage,e.name=a.AuthorName,e.className="git-author-icon-small",c.appendChild(e),d.appendChild(c));c=document.createElement("div");e=document.createElement("div");e.appendChild(document.createTextNode(b.formatMessage(l["authored by 0 (1) on 2"],a.AuthorName,a.AuthorEmail,(new Date(a.Time)).toLocaleString())));c.appendChild(e);e=document.createElement("div");
e.appendChild(document.createTextNode(b.formatMessage(l["committed by 0 (1)"],a.CommitterName,a.CommitterEmail)));c.appendChild(e);d.appendChild(c)}else new k.Section(c,{id:"commitSection",title:l["No Commits"],iconClass:"core-sprite-file"})};d.prototype._splitCommitMessage=function(a){var b=!1,c=a.split(/(\r?\n|$)/)[0].trim();100<c.length&&(b=c.indexOf(" ",90),c=c.substring(0,-1!==b?b:100),b=!0);a=a.substring(c.length+1,a.length).trim();a=0<a.length?b?"..."+a:a:null;return[c+(b?"...":""),a]};d.prototype.displayTags=
function(a){var b=a.Tags,c=f.node("table"),c=new k.Section(c,{id:"tagSection",title:b&&0<b.length?l["Tags:"]:l["No Tags"],iconClass:["gitImageSprite","git-sprite-tag"],slideout:!0,content:'\x3cdiv id\x3d"tagNode"\x3e\x3c/div\x3e',canHide:!0,preferenceService:this.registry.getService("orion.core.preference")});this.commandService.registerCommandContribution(c.actionsNode.id,"eclipse.orion.git.addTag",100);this.commandService.renderCommands(c.actionsNode.id,c.actionsNode,a,this,"button");if(b||!(0<
b.length))for(a=0;a<b.length&&10>a;a++)this.renderTag(b[a])};d.prototype.renderTag=function(a){var b=f.node("tagNode"),c=document.createElement("div");c.className="sectionTableItem";b.appendChild(c);b=document.createElement("div");b.className="sectionTableItem";c.appendChild(b);c=document.createElement("div");c.className="stretch";b.appendChild(c);var d=document.createElement("span");d.textContent=a.Name;c.appendChild(d);c=document.createElement("div");c.className="sectionTableItemActions";b.appendChild(c);
this.commandService.renderCommands(this.actionScopeId,c,a,this,"tool",!1)};d.prototype.displayDiffs=function(b){var c=this,d=b.Diffs;b=f.node("table");b=new k.Section(b,{id:"diffSection",title:l.Diffs,content:'\x3cdiv id\x3d"diffNode"\x3e\x3c/div\x3e',canHide:!0,preferenceService:this.registry.getService("orion.core.preference")});this.commandService.registerCommandContribution(b.actionsNode.id,"orion.explorer.expandAll",100);this.commandService.registerCommandContribution(b.actionsNode.id,"orion.explorer.collapseAll",
200);var g="diffSectionItemActionArea",h=function(){function a(){}a.prototype={destroy:function(){},getRoot:function(a){a(d)},getChildren:function(a,b){a instanceof Array&&0<a.length?b(a):"Diff"===a.Type?(a.children||(a.children=[],a.children.push({parent:a,DiffLocation:a.DiffLocation})),b(a.children)):b([])},getId:function(a){return a instanceof Array&&0<a.length?"diffRoot":"Diff"===a.Type?"diff"+a.DiffLocation:"diffWidget"+a.DiffLocation}};return a}(),m=function(){function b(a,c){this._init(a);
this.options=a;this.explorer=c;this.registry=a.registry}b.prototype=new e.SelectionRenderer;b.prototype.getCellElement=function(b,d,e){switch(b){case 0:if("Diff"===d.Type){b=document.createElement("td");var f=document.createElement("div");f.className="sectionTableItem";b.appendChild(f);var g=d.OldPath,h="git-sprite-file",k=l.Diffs;"ADD"===d.ChangeType?(g=d.NewPath,h="git-sprite-addition",k=l.Addition):"DELETE"===d.ChangeType&&(h="git-sprite-removal",k=l.Deletion);this.getExpandImage(e,f);e=document.createElement("span");
e.className=h;e.classList.add("gitImageSprite");e.commandTooltip=new q.Tooltip({node:e,text:k,position:["above","below","right","left"]});f.appendChild(e);e=document.createElement("span");e.className="gitMainDescription";e.textContent=g;f.appendChild(e)}else{b=document.createElement("td");b.colSpan=2;f=document.createElement("div");f.className="sectionTableItem";b.appendChild(f);e=document.createElement("div");e.className="sectionExplorerActions";f.appendChild(e);var m=document.createElement("span");
m.id="diff"+d.parent.DiffLocation+"DiffActionWrapper";e.appendChild(m);g=document.createElement("span");g.id="diff"+d.parent.DiffLocation+"CompareWidgetActionWrapper";e.appendChild(g);e=document.createElement("div");e.id="diffArea_"+d.parent.DiffLocation;e.style.height="420px";e.style.border="1px solid lightgray";e.style.overflow="hidden";f.appendChild(e);f=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(d,!0):null;a.createCompareWidget(c.registry,c.commandService,d.parent.DiffLocation,
!1,e,g.id,!1,{navGridHolder:f,additionalCmdRender:function(a){c.commandService.destroy(m.id);c.commandService.renderCommands("itemLevelCommands",m.id,d.parent,c,"tool",!1,a)},before:!0})}return b}};return b}(),n=new (function(){function a(b,c,d,e){this.registry=b;this.checkbox=!1;this.parentId=d;this.selection=c;this.actionScopeId=e;this.renderer=new m({registry:this.registry,actionScopeId:g,cachePrefix:"DiffNavigator",checkbox:!1},this);this.createTree(this.parentId,new h,{})}a.prototype=new e.Explorer;
a.prototype.isRowSelectable=function(a){return!1};a.prototype.getItemCount=function(){return d.length};return a}())(this.registry,null,"diffNode",g);this.commandService.renderCommands(b.actionsNode.id,b.actionsNode.id,n,n,"button")};return d}();return n});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(g,l){function k(){}function e(){this.styles=[];var d=new k;d.name="Eclipse";d.annotationRuler="white";d.background="white";d.comment="green";d.keyword="#7f0055";d.text="darkSlateGray";d.string="blue";d.overviewRuler="white";d.lineNumberOdd="#444";d.lineNumberEven="#444";d.lineNumber="#444";d.currentLine="#EAF2FE";d.tag="darkorange";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=
b;this.styles.push(d);d=new k;d.name="Prospecto";d.annotationRuler="white";d.background="white";d.comment="#3C802C";d.keyword="#CC4C07";d.text="#333";d.string="#446FBD";d.overviewRuler="white";d.lineNumberOdd="silver";d.lineNumberEven="silver";d.lineNumber="silver";d.currentLine="#EAF2FE";d.tag="#CC4C07";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=b;this.styles.push(d);d=new k;d.name="Blue";d.annotationRuler="lavender";d.background="aliceBlue";d.comment="indigo";d.keyword="cornFlowerBlue";d.text=
"navy";d.string="cornFlowerBlue";d.overviewRuler="lavender";d.lineNumberOdd="darkSlateGray";d.lineNumberEven="darkSlateGray";d.lineNumber="darkSlateGray";d.currentLine="white";d.tag="cornFlowerBlue";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=b;this.styles.push(d);d=new k;d.name="Ambience";d.annotationRuler="#3D3D3D";d.background="#202020";d.comment="mediumslateblue";d.keyword="cornFlowerBlue";d.text="darkseagreen";d.string="lightcoral";d.overviewRuler="white";d.lineNumberOdd="black";d.lineNumberEven=
"black";d.lineNumber="black";d.currentLine="lightcyan";d.tag="cornFlowerBlue";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=b;this.styles.push(d);d=new k;d.name="Tierra";d.annotationRuler="moccasin";d.background="lemonchiffon";d.comment="darkseagreen";d.keyword="darkred";d.text="#555555";d.string="orangered";d.overviewRuler="moccasin";d.lineNumberOdd="chocolate";d.lineNumberEven="chocolate";d.lineNumber="chocolate";d.currentLine="#baa289";d.tag="darkred";d.attribute="cadetBlue";d.fontFamily=h;
d.fontSize=b;this.styles.push(d);d=new k;d.name="Nimbus";d.annotationRuler="#444";d.background="dimgray";d.comment="darkseagreen";d.keyword="darkorange";d.text="white";d.string="cornflowerblue";d.overviewRuler="#444";d.lineNumberOdd="#aaa";d.lineNumberEven="#aaa";d.lineNumber="#aaa";d.currentLine="#aabfbb";d.tag="darkorange";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=b;this.styles.push(d);d=new k;d.name="Adelante";d.annotationRuler="#E2D2B2";d.background="#F1E7C8";d.comment="#5D774E";d.keyword=
"#AF473B";d.text="dimgray";d.string="#DE5D3B";d.overviewRuler="#E2D2B2";d.lineNumberOdd="#AF473B";d.lineNumberEven="#AF473B";d.lineNumber="#AF473B";d.currentLine="#9e937b";d.tag="#AF473B";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=b;this.styles.push(d);d=new k;d.name="Raspberry Pi";d.annotationRuler="seashell";d.background="seashell";d.comment="#66B32F";d.keyword="#E73E36";d.text="dimgray";d.string="darkorange";d.overviewRuler="seashell";d.lineNumberOdd="#E73E36";d.lineNumberEven="#E73E36";
d.lineNumber="#E73E36";d.currentLine="#F5B1AE";d.tag="#E73E36";d.attribute="cadetBlue";d.fontFamily=h;d.fontSize=b;this.styles.push(d)}function d(){return this.styles}var h='"Consolas", "Monaco", "Vera Mono", "monospace"',b="10pt";e.prototype.styles=[];e.prototype.getStyles=d;e.prototype.fontSettable=!0;e.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",version:"5.0"}};e.prototype.parseToXML=function(b){try{var c=
null;if(window.DOMParser){var c=(new DOMParser).parseFromString(b,"text/xml"),d=c.getElementsByTagName("parsererror");return!d||!d.length||!d[0].childNodes.length?c:null}c=new ActiveXObject("Microsoft.XMLDOM");c.async=!1;c.loadXML(b);return c}catch(a){}};e.prototype.selectFontSize=function(b){console.log("fontsize: "+b)};e.prototype.importTheme=function(b){console.log("import theme");console.log(b);var c=b.parameters.valueFor("name"),c=this.parseToXML(c),d=new k;d.name=c.getElementsByTagName("colorTheme")[0].attributes[1].value;
d.annotationRuler=c.getElementsByTagName("background")[0].attributes[0].value;d.background=c.getElementsByTagName("background")[0].attributes[0].value;d.comment=c.getElementsByTagName("singleLineComment")[0].attributes[0].value;d.keyword=c.getElementsByTagName("keyword")[0].attributes[0].value;d.text=c.getElementsByTagName("foreground")[0].attributes[0].value;d.string=c.getElementsByTagName("string")[0].attributes[0].value;d.overviewRuler=c.getElementsByTagName("background")[0].attributes[0].value;
d.lineNumberOdd=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumberEven=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumber=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.currentLine=c.getElementsByTagName("selectionBackground")[0].attributes[0].value;b.items.addTheme(d)};e.prototype.processSettings=function(b,c){var d=l.TextTheme.getTheme();d.setThemeClass("editorTheme",d.buildStyleSheet("editorTheme",b))};e.prototype.getViewData=function(){var b=
{top:10,left:10,width:400,height:350},c=b.left,d=b.top;b.shapes=[{type:"TEXT",name:g["Line Numbers"],label:"1",x:c+20,y:d+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:g.Background,x:c+46,y:d,width:290,height:b.height,family:"background",fill:"white"},{type:"TEXT",name:g.Strings,label:"'text/javascript'",x:c+134,y:d+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"\x3d",x:c+124,y:d+20,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Current Line"],x:c+46,y:d+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:g["HTML Attribute"],label:"type",x:c+98,y:d+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Overview Ruler"],x:c+336,y:d,width:14,height:b.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:g.Comments,label:"/* comment */",x:c+75,y:d+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},
{type:"TEXT",name:g["HTML Tag"],label:"\x3cscript",x:c+55,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3e",x:c+213,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Strings,label:"'Result'",x:c+164,y:d+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"multiply(a,b){",x:c+120,y:d+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",
name:g.Keywords,label:"function",x:c+75,y:d+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"var",x:c+95,y:d+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"output \x3d ",x:c+115,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:";",x:c+205,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"var",x:c+
95,y:d+100,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"result \x3d a*b;",x:c+115,y:d+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"return",x:c+95,y:d+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"output + result;",x:c+135,y:d+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"}",x:c+75,y:d+140,
fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3c/script\x3e",x:c+55,y:d+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3cstyle",x:c+55,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Attribute"],label:"type",x:c+95,y:d+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"\x3d",x:c+121,y:d+200,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Strings,label:"'text/css'",x:c+131,y:d+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3e",x:c+180,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:".some-class",x:c+75,y:d+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:"{",x:c+145,y:d+220,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Attribute"],label:"color:",x:c+95,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Value"],label:"#123456",x:c+130,y:d+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Text"],label:";",x:c+180,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:"}",x:c+75,y:d+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:g["HTML Tag"],label:"\x3c/style\x3e",x:c+55,y:d+280,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Annotation Ruler"],x:c,y:d,width:46,height:b.height,family:"annotationRuler",fill:"white"}];for(var a=0;16>a;a++)b.shapes.push({type:"TEXT",name:g["Line Numbers"],label:a+1,x:c+20,y:d+20*a+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return b};return{ThemeData:e,getStyles:d}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(g,l){function k(d,e,b,f){g("GET",d,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=c.response?JSON.parse(c.response):null;e.progress(c);!c.type||"loadstart"===c.type||"progress"===c.type?setTimeout(function(){k(d,e,b,f)},2E3):("error"===c.type||"abort"===c.type?e.reject(f?f(c):c.Result):e.resolve(b?b(c):c.Result.JsonData),c.Location||g("DELETE",d,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(b){var d=b;if(void 0!==
b.responseText){d=b.responseText;try{d=JSON.parse(b.responseText)}catch(a){}}void 0!==d.Message?(d.HttpCode=void 0===d.HttpCode?b.status:d.HttpCode,d.Severity=void 0===d.Severity?"Error":d.Severity,e.reject(d)):e.reject({Severity:"Error",Message:d,HttpCode:b.status})})}function e(d,e){e.then(null,function(b){b instanceof Error&&"Cancel"===b.name&&g("PUT",d,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(d,g,b){var f=new l;e(d,f);k(d,f,g,b);return f}}});
define("orion/git/gitClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(g,l,k,e){var d=d||{};d.GitService=function(){function d(b){b&&(this._serviceRegistry=b,this._serviceRegistration=b.registerService("orion.git.provider",this))}d.prototype={checkGitService:function(){},cloneGitRepository:function(b,d,c,e,a,h,q,s,t,y,u){var v=this,x={};b&&(x.Name=b);c&&(x.Path=c);d&&(x.GitUrl=d);x.Location=e;a&&(x.GitSshUsername=a);h&&(x.GitSshPassword=h);q&&(x.GitSshKnownHost=q);s&&(x.GitSshPrivateKey=
s);t&&(x.GitSshPassphrase=t);y&&(y.GitMail&&(x.GitMail=y.GitMail),y.GitName&&(x.GitName=y.GitName));u&&(x.initProject=u);b=g.toUrl("gitapi/clone/._");b=b.substring(0,b.length-2);var z=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(x)}).then(function(a){v._getGitServiceResponse(z,a)},function(a){v._handleGitServiceResponseError(z,a)});return z},removeGitRepository:function(b){var d=this,c=new k;l("DELETE",
b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},getGitStatus:function(b){var d=this,c=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},
stage:function(b){var d=this,c=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},stageMultipleFiles:function(b,d){var c=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:d})}).then(function(a){c._getGitServiceResponse(e,
a)},function(a){c._handleGitServiceResponseError(e,a)});return e},unstageAll:function(b,d){var c=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Reset:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},unstage:function(b,d){var c=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Path:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},checkoutPath:function(b,d){var c=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:d,RemoveUntracked:"true"})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},
commitAll:function(b,d,c){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:c}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},getGitClone:function(b){var d=this,c=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},
function(b){d._handleGitServiceResponseError(c,b)});return c},getGitCloneConfig:function(b){var d=this,c=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},getGitBranch:function(b){var d=this,c=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,
b)},function(b){d._handleGitServiceResponseError(c,b)});return c},getGitRemote:function(b){var d=this,c=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},checkoutBranch:function(b,d){var c=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",
data:JSON.stringify({Branch:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},resetIndex:function(b,d){var c=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Commit:d,Reset:"HARD"})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},addBranch:function(b,d,c){var e=this,
a={};d&&(a.Name=d);c&&(a.Branch=c);var g=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(a)}).then(function(a){e._getGitServiceResponse(g,a)},function(a){e._handleGitServiceResponseError(g,a)});return g},removeBranch:function(b){var d=this,c=new k;l("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,
b)},function(b){d._handleGitServiceResponseError(c,b)});return c},addRemote:function(b,d,c){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Remote:d,RemoteURI:c})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},removeRemote:function(b){var d=this,c=new k;l("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},doGitLog:function(b){var d=this,c=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},getDiff:function(b,d){var c=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({New:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},doFetch:function(b,d,c,e,a,g,h){var s=this,t=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Fetch:"true",Force:d,GitSshUsername:c,GitSshPassword:e,GitSshKnownHost:a,GitSshPrivateKey:g,GitSshPassphrase:h})}).then(function(a){s._getGitServiceResponse(t,
a)},function(a){s._handleGitServiceResponseError(t,a)});return t},doPull:function(b,d,c,e,a,g,h){var s=this,t=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Pull:"true",Force:d,GitSshUsername:c,GitSshPassword:e,GitSshKnownHost:a,GitSshPrivateKey:g,GitSshPassphrase:h})}).then(function(a){s._getGitServiceResponse(t,a)},function(a){s._handleGitServiceResponseError(t,a)});return t},doMerge:function(b,
d,c){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Merge:d,Squash:c})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},doCherryPick:function(b,d){var c=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({"Cherry-Pick":d})}).then(function(a){c._getGitServiceResponse(e,
a)},function(a){c._handleGitServiceResponseError(e,a)});return e},doRevert:function(b,d){var c=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Revert:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},doRebase:function(b,d,c){var e=this,a={};a.Rebase=d;c&&(a.Operation=c);var g=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify(a)}).then(function(a){e._getGitServiceResponse(g,a)},function(a){e._handleGitServiceResponseError(g,a)});return g},doPush:function(b,d,c,e,a,g,h,s,t){var y=this,u=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({PushSrcRef:d,PushTags:c,Force:e,GitSshUsername:a,GitSshPassword:g,GitSshKnownHost:h,GitSshPrivateKey:s,GitSshPassphrase:t})}).then(function(a){y._getGitServiceResponse(u,
a)},function(a){y._handleGitServiceResponseError(u,a)});return u},getLog:function(b,d){var c=this,e=new k,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({New:d})}).then(function(b){a.resolve(b.xhr.getResponseHeader("Location"))},function(a){c._handleGitServiceResponseError(e,a)});a.then(function(a){l("GET",a,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,
handleAs:"json"}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)})});return e},getDefaultRemoteBranch:function(b){var d=this,c=new k,e=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(c,a)});e.then(function(a){l("GET",a.Children[0].Location,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json"}).then(function(a){d._getGitServiceResponse(c,a)},function(a){d._handleGitServiceResponseError(c,a)})});return c},doAddTag:function(b,d){var c=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Name:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},doRemoveTag:function(b){var d=this,c=new k;l("DELETE",
b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},checkoutTag:function(b,d,c){var e=this,a=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Tag:d,Branch:c})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,
b)});return a},addCloneConfigurationProperty:function(b,d,c){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Key:d,Value:c})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},editCloneConfigurationProperty:function(b,d){var c=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Value:d})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},deleteCloneConfigurationProperty:function(b){var d=this,c=new k;l("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){d._getGitServiceResponse(c,b)},function(b){d._handleGitServiceResponseError(c,b)});return c},sendCommitReviewRequest:function(b,
d,c,e,a,g){var h=this,s=new k;l("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({ReviewReqCommit:b,ReviewReqUrl:e,ReviewReqNotifyLogin:c,ReviewReqAuthorName:a,ReviewMessage:g})}).then(function(a){h._getGitServiceResponse(s,a)},function(a){h._handleGitServiceResponseError(s,a)});return s},_getGitServiceResponse:function(b,d){var c=d.response?JSON.parse(d.response):null;if(d.xhr&&202===d.xhr.status){var g=e.handle(c.Location);
g.then(b.resolve,function(a){a.failedOperation=c.Location;b.reject(a)},b.progress);b.then(null,function(a){g.reject(a)})}else b.resolve(c)},_handleGitServiceResponseError:function(b,d){b.reject(d)}};return d}();return d});
define("orion/links",[],function(){function g(g){this._init(g)}g.prototype={_init:function(g){this._registry=g.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.textlink",this)},_replaceLink:function(g,k,e,d,h){var b=g.search(e);0<b&&(k.appendChild(document.createTextNode(g.substring(0,b))),g=g.substring(b));e=g.replace(e,"");var b=g.substring(0,g.length-e.length),f=b.split(" ",d);if(f.length===d){g=document.createElement("a");for(var c=0;c<d;c++)h=h.replace("%"+
(c+1),f[c]);g.setAttribute("href",h);g.textContent=b;k.appendChild(g);g=e}return g},addLinks:function(g,k){var e=k||document.createElement("div"),d=this._registry.getServiceReferences("orion.core.linkScanner");if(0<d.length)for(var h=d[0],d=RegExp(h.getProperty("pattern"),"i"),b=h.getProperty("words"),h=h.getProperty("anchor"),f=g.search(d);0<=f;)g=this._replaceLink(g,e,d,b,h),f=g.search(d);0<g.length&&e.appendChild(document.createTextNode(g));return e}};g.prototype.constructor=g;return{TextLinkService:g}});
var eclipse;
define("built-git-commit.js","i18n!git/nls/gitmessages require orion/bootstrap orion/status orion/progress orion/commandRegistry orion/commands orion/keyBinding orion/dialogs orion/selection orion/fileClient orion/operationsClient orion/searchClient orion/globalCommands orion/git/gitCommitExplorer orion/git/gitCommands orion/widgets/themes/ThemePreferences orion/widgets/themes/editor/ThemeData orion/git/gitClient orion/links orion/contentTypes orion/URITemplate orion/PageUtil".split(" "),function(g,
l,k,e,d,h,b,f,c,m,a,n,q,s,t,y,u,v,x,z,A,C,p){k.startup().then(function(k){var r=k.serviceRegistry;k=k.preferences;new c.DialogService(r);var B=new m.Selection(r),B=new h.CommandRegistry({selection:B}),D=new n.OperationsClient(r);new e.StatusReportingService(r,D,"statusPane","notifications","notificationArea");new d.ProgressService(r,D,B);(new u.ThemePreferences(k,new v.ThemeData)).apply();D=new z.TextLinkService({serviceRegistry:r});new x.GitService(r);var I=new a.FileClient(r);new A.ContentTypeRegistry(r);
var F=new q.Searcher({serviceRegistry:r,commandService:B,fileService:I}),J=new t.GitCommitExplorer(r,B,D,null,"artifacts","pageActions",null,"itemLevelCommands");s.generateBanner("orion-git-commit",r,B,k,F,J);y.createFileCommands(r,B,J,"pageActions","selectionTools");y.createGitClonesCommands(r,B,J,"pageActions","selectionTools",I);B.addCommandGroup("pageActions","eclipse.gitGroup",100);B.registerCommandContribution("pageActions","eclipse.orion.git.cherryPick",100,"eclipse.gitGroup");B.registerCommandContribution("pageActions",
"eclipse.orion.git.revert",101,"eclipse.gitGroup");B.registerCommandContribution("pageActions","eclipse.orion.git.askForReviewCommand",102,"eclipse.gitGroup");B.registerCommandContribution("pageActions","eclipse.orion.git.openCommitCommand",102,"eclipse.gitGroup",!0,new f.KeyBinding("h",!0,!0));B.registerCommandContribution("itemLevelCommands","eclipse.removeTag",1E3);var E=new C("edit/edit.html#{,resource,params*}"),r=new b.Command({name:g["Working Directory Version"],tooltip:g["View the working directory version of the file"],
id:"eclipse.orion.git.diff.showCurrent",hrefCallback:function(a){return l.toUrl(E.expand({resource:a.items.ContentLocation}))},visibleWhen:function(a){return"Diff"===a.Type}});B.addCommand(r);B.registerCommandContribution("itemLevelCommands","eclipse.orion.git.diff.showCurrent",2E3);r=p.matchResourceParameters();J.display(r.resource);window.addEventListener("hashchange",function(){var a=p.matchResourceParameters();J.display(a.resource)},!1)})});
//@ sourceMappingURL=built-git-commit.js.map