index-legacy.76f0d13f.js 539 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612
  1. ;(function(){function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty2(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty2(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _typeof2(obj){"@babel/helpers - typeof";return _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof2(obj);}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._uploadSection_107z7_1{width:150px;height:85px;background:#f8faf9;border-radius:4px;border:1px solid rgba(45,199,170,.26);font-size:14px;color:#2dc7aa;line-height:20px}._uploadClass_107z7_11{height:85px;width:100%}._uploadClass_107z7_11 .el-loading-spinner{margin-top:-33px;height:85px}._avatar-upload-preview_range_107z7_19,._avatar-upload-preview_107z7_19{width:180px;height:180px;box-shadow:0 0 4px #ccc;overflow:hidden}._avatar-upload-preview_range_107z7_19 img,._avatar-upload-preview_107z7_19 img{background-color:#f7f7f7;height:100%}._avatar-upload-preview_range_107z7_19{border-radius:0}._previewImg_107z7_34{padding-left:50px;padding-top:10px}._previewImg_107z7_34>span{display:block;color:#212121;font-size:16px;padding-bottom:15px}._operation_107z7_44{font-size:24px;display:flex;align-items:center;margin-top:20px}._operation_107z7_44>i{margin-left:12px;cursor:pointer}._operation_107z7_44 ._icon-rate_107z7_54{display:inline-block;width:20px;height:20px;background:url(./images/icon_rate.png) no-repeat center;background-size:contain}._vue-cropper_107z7_61{border-radius:5px;overflow:hidden}:deep(._el-dialog_107z7_65){margin-bottom:10vh}:deep(._el-dialog_107z7_65) ._el-dialog__header_107z7_68{background:#fff;padding:15px 20px}:deep(._el-dialog_107z7_65) ._el-dialog__header_107z7_68 ._el-dialog__title_107z7_72{color:#212121}:deep(._el-dialog_107z7_65) ._el-dialog__header_107z7_68 ._el-dialog__headerbtn_107z7_75 ._el-dialog__close_107z7_75{color:#212121}:deep(._el-dialog_107z7_65) ._el-dialog__body_107z7_78{padding-top:0}.before{max-width:400px!important;max-height:400px!important;overflow:hidden}#_myImages_107z7_1{max-width:400px;display:block;width:400px;min-height:400px}.vue-cropper[data-v-be5e5ddc]{position:relative;width:100%;height:100%;box-sizing:border-box;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;direction:ltr;touch-action:none;text-align:left;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-box[data-v-be5e5ddc],.cropper-box-canvas[data-v-be5e5ddc],.cropper-drag-box[data-v-be5e5ddc],.cropper-crop-box[data-v-be5e5ddc],.cropper-face[data-v-be5e5ddc]{position:absolute;top:0;right:0;bottom:0;left:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.cropper-box-canvas img[data-v-be5e5ddc]{position:relative;text-align:left;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:none;max-width:none;max-height:none}.cropper-box[data-v-be5e5ddc]{overflow:hidden}.cropper-move[data-v-be5e5ddc]{cursor:move}.cropper-crop[data-v-be5e5ddc]{cursor:crosshair}.cropper-modal[data-v-be5e5ddc]{background:rgba(0,0,0,.5)}.cropper-view-box[data-v-be5e5ddc]{display:block;overflow:hidden;width:100%;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);-webkit-user-select:none;-moz-user-select:none;user-select:none}.cropper-view-box img[data-v-be5e5ddc]{-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;max-width:none;max-height:none}.cropper-face[data-v-be5e5ddc]{top:0;left:0;background-color:#fff;opacity:.1}.crop-info[data-v-be5e5ddc]{position:absolute;left:0px;min-width:65px;text-align:center;color:#fff;line-height:20px;background-color:rgba(0,0,0,.8);font-size:12px}.crop-line[data-v-be5e5ddc]{position:absolute;display:block;width:100%;height:100%;opacity:.1}.line-w[data-v-be5e5ddc]{top:-3px;left:0;height:5px;cursor:n-resize}.line-a[data-v-be5e5ddc]{top:0;left:-3px;width:5px;cursor:w-resize}.line-s[data-v-be5e5ddc]{bottom:-3px;left:0;height:5px;cursor:s-resize}.line-d[data-v-be5e5ddc]{top:0;right:-3px;width:5px;cursor:e-resize}.crop-point[data-v-be5e5ddc]{position:absolute;width:8px;height:8px;opacity:.75;background-color:#39f;border-radius:100%}.point1[data-v-be5e5ddc]{top:-4px;left:-4px;cursor:nw-resize}.point2[data-v-be5e5ddc]{top:-5px;left:50%;margin-left:-3px;cursor:n-resize}.point3[data-v-be5e5ddc]{top:-4px;right:-4px;cursor:ne-resize}.point4[data-v-be5e5ddc]{top:50%;left:-4px;margin-top:-3px;cursor:w-resize}.point5[data-v-be5e5ddc]{top:50%;right:-4px;margin-top:-3px;cursor:e-resize}.point6[data-v-be5e5ddc]{bottom:-5px;left:-4px;cursor:sw-resize}.point7[data-v-be5e5ddc]{bottom:-5px;left:50%;margin-left:-3px;cursor:s-resize}.point8[data-v-be5e5ddc]{bottom:-5px;right:-4px;cursor:se-resize}@media screen and (max-width: 500px){.crop-point[data-v-be5e5ddc]{position:absolute;width:20px;height:20px;opacity:.45;background-color:#39f;border-radius:100%}.point1[data-v-be5e5ddc]{top:-10px;left:-10px}.point2[data-v-be5e5ddc],.point4[data-v-be5e5ddc],.point5[data-v-be5e5ddc],.point7[data-v-be5e5ddc]{display:none}.point3[data-v-be5e5ddc]{top:-10px;right:-10px}.point4[data-v-be5e5ddc]{top:0;left:0}.point6[data-v-be5e5ddc]{bottom:-10px;left:-10px}.point8[data-v-be5e5ddc]{bottom:-10px;right:-10px}}/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-wrap-box,.cropper-canvas,.cropper-drag-box,.cropper-crop-box,.cropper-modal{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-wrap-box,.cropper-canvas{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:before,.cropper-center:after{background-color:#eee;content:\" \";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width: 768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width: 992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width: 1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:\" \";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}\n";document.head.appendChild(__vite_style__);System.register(['./index-legacy.ae6b81dc.js','./vendor-legacy.7f609859.js'],function(exports){'use strict';var request,commonjsGlobal,getDefaultExportFromCjs,defineComponent,ElMessage,createVNode,ElDialog,ElRow,ElCol,createTextVNode,ElButton,ElUpload,ElImage;return{setters:[function(module){request=module.r;},function(module){commonjsGlobal=module.af;getDefaultExportFromCjs=module.ag;defineComponent=module.d;ElMessage=module.E;createVNode=module.c;ElDialog=module.K;ElRow=module.q;ElCol=module.v;createTextVNode=module.a;ElButton=module.k;ElUpload=module.ah;ElImage=module.x;}],execute:function execute(){var uploadSection="_uploadSection_107z7_1";var uploadClass="_uploadClass_107z7_11";var previewImg="_previewImg_107z7_34";var operation="_operation_107z7_44";var myImages="_myImages_107z7_1";var styles={uploadSection:uploadSection,uploadClass:uploadClass,"avatar-upload-preview_range":"_avatar-upload-preview_range_107z7_19","avatar-upload-preview":"_avatar-upload-preview_107z7_19",previewImg:previewImg,operation:operation,"icon-rate":"_icon-rate_107z7_54","vue-cropper":"_vue-cropper_107z7_61","el-dialog":"_el-dialog_107z7_65","el-dialog__header":"_el-dialog__header_107z7_68","el-dialog__title":"_el-dialog__title_107z7_72","el-dialog__headerbtn":"_el-dialog__headerbtn_107z7_75","el-dialog__close":"_el-dialog__close_107z7_75","el-dialog__body":"_el-dialog__body_107z7_78",myImages:myImages};var iconUpload=exports('i',"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA4CAMAAAB6xg5AAAAAAXNSR0IArs4c6QAAAsRQTFRFAAAAAP8AAP//AICAAP+AAP//AKqqVaqqVf+qAL+/QL+/M8yZKqqqKtWqJNu2IN+/HMaqM8yZM8yzLtGiLtG5Kr+qJMikML+fMM+vM8ymLMixKcKjKcKtKcytJ8SnJ86xMcSnL8aqLsitLMqwKsOqKcWtMMenMMevLsmqLcOtLcutLMWoK8aqKcilKcisMMisL8moLsSqLcysLMeuK8iqL8qsLcaqLMisK8moK8muMMqqL8usLMmsL8yqLsmrLcqpLcqtLcaqK8ipLcepK8apK8msLcerLMmqLMaoLMmrLsepLcWoLcapLMaqLsipLsisLsWqLMepLMeqLsirLcerLsarLsmrLceqLcqqLMisLsmqLserLcesLciqLcmrLcipLcisLcaqLMepLMesLMaqLsiqLsirLMirLMipLcerLcmrLciqLMepLseqLsmqLcipLcirLMepLcapLcepLMeqLMiqLsiqLsipLceqLcerLcipLsiqLsepLcepLceqLcirLMirLMeqLcerLcirLcepLcisLserLsiqLcerLceqLcirLMepLcerLciqLMeqLceqLciqLcirLceqLMepLseqLserLcaqLciqLceqLceqLceqLMiqLsiqLcirLceqLcepLceqLcaqLciqLsaqLMepLsiqLceqLcerLceqLciqLseqLcerLceqLceqLciqLceqLceqLciqLceqLcaqLcirLMeqLceqLceqLcerLciqLcepLceqLciqLMeqLMeqLceqLceqLcirLceqLciqLceqLMeqLMerLMaqLceqLcirLceqLceqLceqLceqLceqLMiqLMeqLceqLcepLceqLceqLMeqLMeqLcaqLceqLceqLceqLceqLMepLMeqLceqLcaqLceqLciqLcepLceqLcerLceqLMeqLMiqLciqLceqLcirLceqkeY/1AAAAOt0Uk5TAAEBAgICAwMDBAQFBgYHCAkKCgsLDA4QEBQXGRkZGhoaGxwdHh8gICEiIiMkJSUlJicoKSorLS4vLzAxNDw9Pj4/QURHR0lLTExNT1BRU1NUVldYW15eYGBiY2RlZmdra2xubm9vcHN0dnZ4ent7fX2AgoOEioqMjY6PkJGSk5SVlpqdnp+goqSlpqepqqyur7CxsrOztLS1tre4uLm6u7y9vb2+vr+/wMLExcrMzM3O0NLU1NXV1tfY2dnZ2tvb3N3e3t/g4OHj4+Tl5+jq6+zt7u7w8fLz8/T19vf39/j5+fr6+/z9/f3+/ne0wvQAAAMbSURBVEjHnZb5W0xRGMdfyVjSqMiSfUsGCZUoS4WyZkkiS6Hs+55s2RIp+74rW5aIsmUP2WWUBoWS6fwT7n3vzG3uzD1z79z3p3M+53w/zzxz3nOeC2BrheUVHfME5RVYSQh55krf0Hz2xkTL2jS3nWF9J2FrODU/vYSI14853IZ0nEXT8lFVhFozcEeGVYHTJ3qeFDeWFowk1ipcWrCVltUu9XWpZScpUH2g5O958HusCgZQ8jqmcTRRMVgPkaTgOHp0Iz5bz5WptRRBAkBEqejK066YDk5+W2nt3wsCN1p7nGDiTfcTidJAKG2pFKDJHak88Qc/2lIeQJpknsQB7BBfqQyDgdJ58kQNqtiDGelsFSJ5wA4z0ncFAmyWISDbVfQ+eEyPVRSXG4fnfKmCn+Lh16uHtGZWWw5akY/zqpzDqWlp86oF9vUNAtF4waTq32w/Pp/nqdWCOi5WBBucBB2uXlVlKahNF/yeanFJjI3MC2KsCSaKXLNxelw6AnAUBxPAmSqIN75OwxasWTjCuG05d60BZmIDdwFvmuCRA+IGi7XcO7asIfdU3MJpb1AxPVkSAbCEJhiLtEUmD7LaIxnK9QNzOn6hbgAeWorgdg0WutwwQdn4mMJVrifVOPG8TyiC+QhXCk8VWazhXsT5a4ISdIQmCGBZs+/Cc23Lwl5mO8UF5Y4sizTbO42Fdjo5glfI1psJtiC9K0eQiyzFTHAI6XU5gufIEs0ESUiz5Qh0NVk2y0ywCHd+liMg3VjWXS+EfVjYRtYpkCkIUwXsOLJweYLTCDt9NEFfeiDbJ0+gx06CfoU8+RqMxKdCnoCc5bDXBcP8sg8HDhCZAu4zgqn+8Weyzq8Lon56UAW6AJEXybdIvoC86WuR935JbBCQb6PM8iFaYpOA6Hd7mcQ7J/8jNgoI+ZMUwn29OA/eVia+xbqAdeSe2nMy5xd1XVIgVUZBmcK83sEgeKFQ8N74HycrFOzlz1ihYAx/zBcV5TPteEGrAgX5d+4mndbhms35mxrhR3rkpQob0n+vTK5rcd0cO/aUW+5qQfI/vbBmnVf4WssAAAAASUVORK5CYII=");var index='';/*!
  2. * Cropper.js v1.5.12
  3. * https://fengyuanchen.github.io/cropperjs
  4. *
  5. * Copyright 2015-present Chen Fengyuan
  6. * Released under the MIT license
  7. *
  8. * Date: 2021-06-12T08:00:17.411Z
  9. */function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var IS_BROWSER=typeof window!=='undefined'&&typeof window.document!=='undefined';var WINDOW=IS_BROWSER?window:{};var IS_TOUCH_DEVICE=IS_BROWSER&&WINDOW.document.documentElement?'ontouchstart'in WINDOW.document.documentElement:false;var HAS_POINTER_EVENT=IS_BROWSER?'PointerEvent'in WINDOW:false;var NAMESPACE='cropper';// Actions
  10. var ACTION_ALL='all';var ACTION_CROP='crop';var ACTION_MOVE='move';var ACTION_ZOOM='zoom';var ACTION_EAST='e';var ACTION_WEST='w';var ACTION_SOUTH='s';var ACTION_NORTH='n';var ACTION_NORTH_EAST='ne';var ACTION_NORTH_WEST='nw';var ACTION_SOUTH_EAST='se';var ACTION_SOUTH_WEST='sw';// Classes
  11. var CLASS_CROP="".concat(NAMESPACE,"-crop");var CLASS_DISABLED="".concat(NAMESPACE,"-disabled");var CLASS_HIDDEN="".concat(NAMESPACE,"-hidden");var CLASS_HIDE="".concat(NAMESPACE,"-hide");var CLASS_INVISIBLE="".concat(NAMESPACE,"-invisible");var CLASS_MODAL="".concat(NAMESPACE,"-modal");var CLASS_MOVE="".concat(NAMESPACE,"-move");// Data keys
  12. var DATA_ACTION="".concat(NAMESPACE,"Action");var DATA_PREVIEW="".concat(NAMESPACE,"Preview");// Drag modes
  13. var DRAG_MODE_CROP='crop';var DRAG_MODE_MOVE='move';var DRAG_MODE_NONE='none';// Events
  14. var EVENT_CROP='crop';var EVENT_CROP_END='cropend';var EVENT_CROP_MOVE='cropmove';var EVENT_CROP_START='cropstart';var EVENT_DBLCLICK='dblclick';var EVENT_TOUCH_START=IS_TOUCH_DEVICE?'touchstart':'mousedown';var EVENT_TOUCH_MOVE=IS_TOUCH_DEVICE?'touchmove':'mousemove';var EVENT_TOUCH_END=IS_TOUCH_DEVICE?'touchend touchcancel':'mouseup';var EVENT_POINTER_DOWN=HAS_POINTER_EVENT?'pointerdown':EVENT_TOUCH_START;var EVENT_POINTER_MOVE=HAS_POINTER_EVENT?'pointermove':EVENT_TOUCH_MOVE;var EVENT_POINTER_UP=HAS_POINTER_EVENT?'pointerup pointercancel':EVENT_TOUCH_END;var EVENT_READY='ready';var EVENT_RESIZE='resize';var EVENT_WHEEL='wheel';var EVENT_ZOOM='zoom';// Mime types
  15. var MIME_TYPE_JPEG='image/jpeg';// RegExps
  16. var REGEXP_ACTIONS=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;var REGEXP_DATA_URL=/^data:/;var REGEXP_DATA_URL_JPEG=/^data:image\/jpeg;base64,/;var REGEXP_TAG_NAME=/^img|canvas$/i;// Misc
  17. // Inspired by the default width and height of a canvas element.
  18. var MIN_CONTAINER_WIDTH=200;var MIN_CONTAINER_HEIGHT=100;var DEFAULTS={// Define the view mode of the cropper
  19. viewMode:0,// 0, 1, 2, 3
  20. // Define the dragging mode of the cropper
  21. dragMode:DRAG_MODE_CROP,// 'crop', 'move' or 'none'
  22. // Define the initial aspect ratio of the crop box
  23. initialAspectRatio:NaN,// Define the aspect ratio of the crop box
  24. aspectRatio:NaN,// An object with the previous cropping result data
  25. data:null,// A selector for adding extra containers to preview
  26. preview:'',// Re-render the cropper when resize the window
  27. responsive:true,// Restore the cropped area after resize the window
  28. restore:true,// Check if the current image is a cross-origin image
  29. checkCrossOrigin:true,// Check the current image's Exif Orientation information
  30. checkOrientation:true,// Show the black modal
  31. modal:true,// Show the dashed lines for guiding
  32. guides:true,// Show the center indicator for guiding
  33. center:true,// Show the white modal to highlight the crop box
  34. highlight:true,// Show the grid background
  35. background:true,// Enable to crop the image automatically when initialize
  36. autoCrop:true,// Define the percentage of automatic cropping area when initializes
  37. autoCropArea:0.8,// Enable to move the image
  38. movable:true,// Enable to rotate the image
  39. rotatable:true,// Enable to scale the image
  40. scalable:true,// Enable to zoom the image
  41. zoomable:true,// Enable to zoom the image by dragging touch
  42. zoomOnTouch:true,// Enable to zoom the image by wheeling mouse
  43. zoomOnWheel:true,// Define zoom ratio when zoom the image by wheeling mouse
  44. wheelZoomRatio:0.1,// Enable to move the crop box
  45. cropBoxMovable:true,// Enable to resize the crop box
  46. cropBoxResizable:true,// Toggle drag mode between "crop" and "move" when click twice on the cropper
  47. toggleDragModeOnDblclick:true,// Size limitation
  48. minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:MIN_CONTAINER_WIDTH,minContainerHeight:MIN_CONTAINER_HEIGHT,// Shortcuts of events
  49. ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null};var TEMPLATE='<div class="cropper-container" touch-action="none">'+'<div class="cropper-wrap-box">'+'<div class="cropper-canvas"></div>'+'</div>'+'<div class="cropper-drag-box"></div>'+'<div class="cropper-crop-box">'+'<span class="cropper-view-box"></span>'+'<span class="cropper-dashed dashed-h"></span>'+'<span class="cropper-dashed dashed-v"></span>'+'<span class="cropper-center"></span>'+'<span class="cropper-face"></span>'+'<span class="cropper-line line-e" data-cropper-action="e"></span>'+'<span class="cropper-line line-n" data-cropper-action="n"></span>'+'<span class="cropper-line line-w" data-cropper-action="w"></span>'+'<span class="cropper-line line-s" data-cropper-action="s"></span>'+'<span class="cropper-point point-e" data-cropper-action="e"></span>'+'<span class="cropper-point point-n" data-cropper-action="n"></span>'+'<span class="cropper-point point-w" data-cropper-action="w"></span>'+'<span class="cropper-point point-s" data-cropper-action="s"></span>'+'<span class="cropper-point point-ne" data-cropper-action="ne"></span>'+'<span class="cropper-point point-nw" data-cropper-action="nw"></span>'+'<span class="cropper-point point-sw" data-cropper-action="sw"></span>'+'<span class="cropper-point point-se" data-cropper-action="se"></span>'+'</div>'+'</div>';/**
  50. * Check if the given value is not a number.
  51. */var isNaN=Number.isNaN||WINDOW.isNaN;/**
  52. * Check if the given value is a number.
  53. * @param {*} value - The value to check.
  54. * @returns {boolean} Returns `true` if the given value is a number, else `false`.
  55. */function isNumber(value){return typeof value==='number'&&!isNaN(value);}/**
  56. * Check if the given value is a positive number.
  57. * @param {*} value - The value to check.
  58. * @returns {boolean} Returns `true` if the given value is a positive number, else `false`.
  59. */var isPositiveNumber=function isPositiveNumber(value){return value>0&&value<Infinity;};/**
  60. * Check if the given value is undefined.
  61. * @param {*} value - The value to check.
  62. * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
  63. */function isUndefined(value){return typeof value==='undefined';}/**
  64. * Check if the given value is an object.
  65. * @param {*} value - The value to check.
  66. * @returns {boolean} Returns `true` if the given value is an object, else `false`.
  67. */function isObject(value){return _typeof(value)==='object'&&value!==null;}var hasOwnProperty=Object.prototype.hasOwnProperty;/**
  68. * Check if the given value is a plain object.
  69. * @param {*} value - The value to check.
  70. * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
  71. */function isPlainObject(value){if(!isObject(value)){return false;}try{var _constructor=value.constructor;var prototype=_constructor.prototype;return _constructor&&prototype&&hasOwnProperty.call(prototype,'isPrototypeOf');}catch(error){return false;}}/**
  72. * Check if the given value is a function.
  73. * @param {*} value - The value to check.
  74. * @returns {boolean} Returns `true` if the given value is a function, else `false`.
  75. */function isFunction(value){return typeof value==='function';}var slice=Array.prototype.slice;/**
  76. * Convert array-like or iterable object to an array.
  77. * @param {*} value - The value to convert.
  78. * @returns {Array} Returns a new array.
  79. */function toArray(value){return Array.from?Array.from(value):slice.call(value);}/**
  80. * Iterate the given data.
  81. * @param {*} data - The data to iterate.
  82. * @param {Function} callback - The process function for each element.
  83. * @returns {*} The original data.
  84. */function forEach(data,callback){if(data&&isFunction(callback)){if(Array.isArray(data)||isNumber(data.length)/* array-like */){toArray(data).forEach(function(value,key){callback.call(data,value,key,data);});}else if(isObject(data)){Object.keys(data).forEach(function(key){callback.call(data,data[key],key,data);});}}return data;}/**
  85. * Extend the given object.
  86. * @param {*} target - The target object to extend.
  87. * @param {*} args - The rest objects for merging to the target object.
  88. * @returns {Object} The extended object.
  89. */var assign=Object.assign||function assign(target){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}if(isObject(target)&&args.length>0){args.forEach(function(arg){if(isObject(arg)){Object.keys(arg).forEach(function(key){target[key]=arg[key];});}});}return target;};var REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;/**
  90. * Normalize decimal number.
  91. * Check out {@link https://0.30000000000000004.com/}
  92. * @param {number} value - The value to normalize.
  93. * @param {number} [times=100000000000] - The times for normalizing.
  94. * @returns {number} Returns the normalized number.
  95. */function normalizeDecimalNumber(value){var times=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100000000000;return REGEXP_DECIMALS.test(value)?Math.round(value*times)/times:value;}var REGEXP_SUFFIX=/^width|height|left|top|marginLeft|marginTop$/;/**
  96. * Apply styles to the given element.
  97. * @param {Element} element - The target element.
  98. * @param {Object} styles - The styles for applying.
  99. */function setStyle(element,styles){var style=element.style;forEach(styles,function(value,property){if(REGEXP_SUFFIX.test(property)&&isNumber(value)){value="".concat(value,"px");}style[property]=value;});}/**
  100. * Check if the given element has a special class.
  101. * @param {Element} element - The element to check.
  102. * @param {string} value - The class to search.
  103. * @returns {boolean} Returns `true` if the special class was found.
  104. */function hasClass(element,value){return element.classList?element.classList.contains(value):element.className.indexOf(value)>-1;}/**
  105. * Add classes to the given element.
  106. * @param {Element} element - The target element.
  107. * @param {string} value - The classes to be added.
  108. */function addClass(element,value){if(!value){return;}if(isNumber(element.length)){forEach(element,function(elem){addClass(elem,value);});return;}if(element.classList){element.classList.add(value);return;}var className=element.className.trim();if(!className){element.className=value;}else if(className.indexOf(value)<0){element.className="".concat(className," ").concat(value);}}/**
  109. * Remove classes from the given element.
  110. * @param {Element} element - The target element.
  111. * @param {string} value - The classes to be removed.
  112. */function removeClass(element,value){if(!value){return;}if(isNumber(element.length)){forEach(element,function(elem){removeClass(elem,value);});return;}if(element.classList){element.classList.remove(value);return;}if(element.className.indexOf(value)>=0){element.className=element.className.replace(value,'');}}/**
  113. * Add or remove classes from the given element.
  114. * @param {Element} element - The target element.
  115. * @param {string} value - The classes to be toggled.
  116. * @param {boolean} added - Add only.
  117. */function toggleClass(element,value,added){if(!value){return;}if(isNumber(element.length)){forEach(element,function(elem){toggleClass(elem,value,added);});return;}// IE10-11 doesn't support the second parameter of `classList.toggle`
  118. if(added){addClass(element,value);}else{removeClass(element,value);}}var REGEXP_CAMEL_CASE=/([a-z\d])([A-Z])/g;/**
  119. * Transform the given string from camelCase to kebab-case
  120. * @param {string} value - The value to transform.
  121. * @returns {string} The transformed value.
  122. */function toParamCase(value){return value.replace(REGEXP_CAMEL_CASE,'$1-$2').toLowerCase();}/**
  123. * Get data from the given element.
  124. * @param {Element} element - The target element.
  125. * @param {string} name - The data key to get.
  126. * @returns {string} The data value.
  127. */function getData(element,name){if(isObject(element[name])){return element[name];}if(element.dataset){return element.dataset[name];}return element.getAttribute("data-".concat(toParamCase(name)));}/**
  128. * Set data to the given element.
  129. * @param {Element} element - The target element.
  130. * @param {string} name - The data key to set.
  131. * @param {string} data - The data value.
  132. */function setData(element,name,data){if(isObject(data)){element[name]=data;}else if(element.dataset){element.dataset[name]=data;}else{element.setAttribute("data-".concat(toParamCase(name)),data);}}/**
  133. * Remove data from the given element.
  134. * @param {Element} element - The target element.
  135. * @param {string} name - The data key to remove.
  136. */function removeData(element,name){if(isObject(element[name])){try{delete element[name];}catch(error){element[name]=undefined;}}else if(element.dataset){// #128 Safari not allows to delete dataset property
  137. try{delete element.dataset[name];}catch(error){element.dataset[name]=undefined;}}else{element.removeAttribute("data-".concat(toParamCase(name)));}}var REGEXP_SPACES=/\s\s*/;var onceSupported=function(){var supported=false;if(IS_BROWSER){var once=false;var listener=function listener(){};var options=Object.defineProperty({},'once',{get:function get(){supported=true;return once;},/**
  138. * This setter can fix a `TypeError` in strict mode
  139. * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
  140. * @param {boolean} value - The value to set
  141. */set:function set(value){once=value;}});WINDOW.addEventListener('test',listener,options);WINDOW.removeEventListener('test',listener,options);}return supported;}();/**
  142. * Remove event listener from the target element.
  143. * @param {Element} element - The event target.
  144. * @param {string} type - The event type(s).
  145. * @param {Function} listener - The event listener.
  146. * @param {Object} options - The event options.
  147. */function removeListener(element,type,listener){var options=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var handler=listener;type.trim().split(REGEXP_SPACES).forEach(function(event){if(!onceSupported){var listeners=element.listeners;if(listeners&&listeners[event]&&listeners[event][listener]){handler=listeners[event][listener];delete listeners[event][listener];if(Object.keys(listeners[event]).length===0){delete listeners[event];}if(Object.keys(listeners).length===0){delete element.listeners;}}}element.removeEventListener(event,handler,options);});}/**
  148. * Add event listener to the target element.
  149. * @param {Element} element - The event target.
  150. * @param {string} type - The event type(s).
  151. * @param {Function} listener - The event listener.
  152. * @param {Object} options - The event options.
  153. */function addListener(element,type,listener){var options=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var _handler=listener;type.trim().split(REGEXP_SPACES).forEach(function(event){if(options.once&&!onceSupported){var _element$listeners=element.listeners,listeners=_element$listeners===void 0?{}:_element$listeners;_handler=function handler(){delete listeners[event][listener];element.removeEventListener(event,_handler,options);for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}listener.apply(element,args);};if(!listeners[event]){listeners[event]={};}if(listeners[event][listener]){element.removeEventListener(event,listeners[event][listener],options);}listeners[event][listener]=_handler;element.listeners=listeners;}element.addEventListener(event,_handler,options);});}/**
  154. * Dispatch event on the target element.
  155. * @param {Element} element - The event target.
  156. * @param {string} type - The event type(s).
  157. * @param {Object} data - The additional event data.
  158. * @returns {boolean} Indicate if the event is default prevented or not.
  159. */function dispatchEvent(element,type,data){var event;// Event and CustomEvent on IE9-11 are global objects, not constructors
  160. if(isFunction(Event)&&isFunction(CustomEvent)){event=new CustomEvent(type,{detail:data,bubbles:true,cancelable:true});}else{event=document.createEvent('CustomEvent');event.initCustomEvent(type,true,true,data);}return element.dispatchEvent(event);}/**
  161. * Get the offset base on the document.
  162. * @param {Element} element - The target element.
  163. * @returns {Object} The offset data.
  164. */function getOffset(element){var box=element.getBoundingClientRect();return{left:box.left+(window.pageXOffset-document.documentElement.clientLeft),top:box.top+(window.pageYOffset-document.documentElement.clientTop)};}var location$1=WINDOW.location;var REGEXP_ORIGINS=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;/**
  165. * Check if the given URL is a cross origin URL.
  166. * @param {string} url - The target URL.
  167. * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
  168. */function isCrossOriginURL(url){var parts=url.match(REGEXP_ORIGINS);return parts!==null&&(parts[1]!==location$1.protocol||parts[2]!==location$1.hostname||parts[3]!==location$1.port);}/**
  169. * Add timestamp to the given URL.
  170. * @param {string} url - The target URL.
  171. * @returns {string} The result URL.
  172. */function addTimestamp(url){var timestamp="timestamp=".concat(new Date().getTime());return url+(url.indexOf('?')===-1?'?':'&')+timestamp;}/**
  173. * Get transforms base on the given object.
  174. * @param {Object} obj - The target object.
  175. * @returns {string} A string contains transform values.
  176. */function getTransforms(_ref){var rotate=_ref.rotate,scaleX=_ref.scaleX,scaleY=_ref.scaleY,translateX=_ref.translateX,translateY=_ref.translateY;var values=[];if(isNumber(translateX)&&translateX!==0){values.push("translateX(".concat(translateX,"px)"));}if(isNumber(translateY)&&translateY!==0){values.push("translateY(".concat(translateY,"px)"));}// Rotate should come first before scale to match orientation transform
  177. if(isNumber(rotate)&&rotate!==0){values.push("rotate(".concat(rotate,"deg)"));}if(isNumber(scaleX)&&scaleX!==1){values.push("scaleX(".concat(scaleX,")"));}if(isNumber(scaleY)&&scaleY!==1){values.push("scaleY(".concat(scaleY,")"));}var transform=values.length?values.join(' '):'none';return{WebkitTransform:transform,msTransform:transform,transform:transform};}/**
  178. * Get the max ratio of a group of pointers.
  179. * @param {string} pointers - The target pointers.
  180. * @returns {number} The result ratio.
  181. */function getMaxZoomRatio(pointers){var pointers2=_objectSpread2({},pointers);var maxRatio=0;forEach(pointers,function(pointer,pointerId){delete pointers2[pointerId];forEach(pointers2,function(pointer2){var x1=Math.abs(pointer.startX-pointer2.startX);var y1=Math.abs(pointer.startY-pointer2.startY);var x2=Math.abs(pointer.endX-pointer2.endX);var y2=Math.abs(pointer.endY-pointer2.endY);var z1=Math.sqrt(x1*x1+y1*y1);var z2=Math.sqrt(x2*x2+y2*y2);var ratio=(z2-z1)/z1;if(Math.abs(ratio)>Math.abs(maxRatio)){maxRatio=ratio;}});});return maxRatio;}/**
  182. * Get a pointer from an event object.
  183. * @param {Object} event - The target event object.
  184. * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
  185. * @returns {Object} The result pointer contains start and/or end point coordinates.
  186. */function getPointer(_ref2,endOnly){var pageX=_ref2.pageX,pageY=_ref2.pageY;var end={endX:pageX,endY:pageY};return endOnly?end:_objectSpread2({startX:pageX,startY:pageY},end);}/**
  187. * Get the center point coordinate of a group of pointers.
  188. * @param {Object} pointers - The target pointers.
  189. * @returns {Object} The center point coordinate.
  190. */function getPointersCenter(pointers){var pageX=0;var pageY=0;var count=0;forEach(pointers,function(_ref3){var startX=_ref3.startX,startY=_ref3.startY;pageX+=startX;pageY+=startY;count+=1;});pageX/=count;pageY/=count;return{pageX:pageX,pageY:pageY};}/**
  191. * Get the max sizes in a rectangle under the given aspect ratio.
  192. * @param {Object} data - The original sizes.
  193. * @param {string} [type='contain'] - The adjust type.
  194. * @returns {Object} The result sizes.
  195. */function getAdjustedSizes(_ref4)// or 'cover'
  196. {var aspectRatio=_ref4.aspectRatio,height=_ref4.height,width=_ref4.width;var type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'contain';var isValidWidth=isPositiveNumber(width);var isValidHeight=isPositiveNumber(height);if(isValidWidth&&isValidHeight){var adjustedWidth=height*aspectRatio;if(type==='contain'&&adjustedWidth>width||type==='cover'&&adjustedWidth<width){height=width/aspectRatio;}else{width=height*aspectRatio;}}else if(isValidWidth){height=width/aspectRatio;}else if(isValidHeight){width=height*aspectRatio;}return{width:width,height:height};}/**
  197. * Get the new sizes of a rectangle after rotated.
  198. * @param {Object} data - The original sizes.
  199. * @returns {Object} The result sizes.
  200. */function getRotatedSizes(_ref5){var width=_ref5.width,height=_ref5.height,degree=_ref5.degree;degree=Math.abs(degree)%180;if(degree===90){return{width:height,height:width};}var arc=degree%90*Math.PI/180;var sinArc=Math.sin(arc);var cosArc=Math.cos(arc);var newWidth=width*cosArc+height*sinArc;var newHeight=width*sinArc+height*cosArc;return degree>90?{width:newHeight,height:newWidth}:{width:newWidth,height:newHeight};}/**
  201. * Get a canvas which drew the given image.
  202. * @param {HTMLImageElement} image - The image for drawing.
  203. * @param {Object} imageData - The image data.
  204. * @param {Object} canvasData - The canvas data.
  205. * @param {Object} options - The options.
  206. * @returns {HTMLCanvasElement} The result canvas.
  207. */function getSourceCanvas(image,_ref6,_ref7,_ref8){var imageAspectRatio=_ref6.aspectRatio,imageNaturalWidth=_ref6.naturalWidth,imageNaturalHeight=_ref6.naturalHeight,_ref6$rotate=_ref6.rotate,rotate=_ref6$rotate===void 0?0:_ref6$rotate,_ref6$scaleX=_ref6.scaleX,scaleX=_ref6$scaleX===void 0?1:_ref6$scaleX,_ref6$scaleY=_ref6.scaleY,scaleY=_ref6$scaleY===void 0?1:_ref6$scaleY;var aspectRatio=_ref7.aspectRatio,naturalWidth=_ref7.naturalWidth,naturalHeight=_ref7.naturalHeight;var _ref8$fillColor=_ref8.fillColor,fillColor=_ref8$fillColor===void 0?'transparent':_ref8$fillColor,_ref8$imageSmoothingE=_ref8.imageSmoothingEnabled,imageSmoothingEnabled=_ref8$imageSmoothingE===void 0?true:_ref8$imageSmoothingE,_ref8$imageSmoothingQ=_ref8.imageSmoothingQuality,imageSmoothingQuality=_ref8$imageSmoothingQ===void 0?'low':_ref8$imageSmoothingQ,_ref8$maxWidth=_ref8.maxWidth,maxWidth=_ref8$maxWidth===void 0?Infinity:_ref8$maxWidth,_ref8$maxHeight=_ref8.maxHeight,maxHeight=_ref8$maxHeight===void 0?Infinity:_ref8$maxHeight,_ref8$minWidth=_ref8.minWidth,minWidth=_ref8$minWidth===void 0?0:_ref8$minWidth,_ref8$minHeight=_ref8.minHeight,minHeight=_ref8$minHeight===void 0?0:_ref8$minHeight;var canvas=document.createElement('canvas');var context=canvas.getContext('2d');var maxSizes=getAdjustedSizes({aspectRatio:aspectRatio,width:maxWidth,height:maxHeight});var minSizes=getAdjustedSizes({aspectRatio:aspectRatio,width:minWidth,height:minHeight},'cover');var width=Math.min(maxSizes.width,Math.max(minSizes.width,naturalWidth));var height=Math.min(maxSizes.height,Math.max(minSizes.height,naturalHeight));// Note: should always use image's natural sizes for drawing as
  208. // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
  209. var destMaxSizes=getAdjustedSizes({aspectRatio:imageAspectRatio,width:maxWidth,height:maxHeight});var destMinSizes=getAdjustedSizes({aspectRatio:imageAspectRatio,width:minWidth,height:minHeight},'cover');var destWidth=Math.min(destMaxSizes.width,Math.max(destMinSizes.width,imageNaturalWidth));var destHeight=Math.min(destMaxSizes.height,Math.max(destMinSizes.height,imageNaturalHeight));var params=[-destWidth/2,-destHeight/2,destWidth,destHeight];canvas.width=normalizeDecimalNumber(width);canvas.height=normalizeDecimalNumber(height);context.fillStyle=fillColor;context.fillRect(0,0,width,height);context.save();context.translate(width/2,height/2);context.rotate(rotate*Math.PI/180);context.scale(scaleX,scaleY);context.imageSmoothingEnabled=imageSmoothingEnabled;context.imageSmoothingQuality=imageSmoothingQuality;context.drawImage.apply(context,[image].concat(_toConsumableArray(params.map(function(param){return Math.floor(normalizeDecimalNumber(param));}))));context.restore();return canvas;}var fromCharCode=String.fromCharCode;/**
  210. * Get string from char code in data view.
  211. * @param {DataView} dataView - The data view for read.
  212. * @param {number} start - The start index.
  213. * @param {number} length - The read length.
  214. * @returns {string} The read result.
  215. */function getStringFromCharCode(dataView,start,length){var str='';length+=start;for(var i=start;i<length;i+=1){str+=fromCharCode(dataView.getUint8(i));}return str;}var REGEXP_DATA_URL_HEAD=/^data:.*,/;/**
  216. * Transform Data URL to array buffer.
  217. * @param {string} dataURL - The Data URL to transform.
  218. * @returns {ArrayBuffer} The result array buffer.
  219. */function dataURLToArrayBuffer(dataURL){var base64=dataURL.replace(REGEXP_DATA_URL_HEAD,'');var binary=atob(base64);var arrayBuffer=new ArrayBuffer(binary.length);var uint8=new Uint8Array(arrayBuffer);forEach(uint8,function(value,i){uint8[i]=binary.charCodeAt(i);});return arrayBuffer;}/**
  220. * Transform array buffer to Data URL.
  221. * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
  222. * @param {string} mimeType - The mime type of the Data URL.
  223. * @returns {string} The result Data URL.
  224. */function arrayBufferToDataURL(arrayBuffer,mimeType){var chunks=[];// Chunk Typed Array for better performance (#435)
  225. var chunkSize=8192;var uint8=new Uint8Array(arrayBuffer);while(uint8.length>0){// XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9
  226. // eslint-disable-next-line prefer-spread
  227. chunks.push(fromCharCode.apply(null,toArray(uint8.subarray(0,chunkSize))));uint8=uint8.subarray(chunkSize);}return"data:".concat(mimeType,";base64,").concat(btoa(chunks.join('')));}/**
  228. * Get orientation value from given array buffer.
  229. * @param {ArrayBuffer} arrayBuffer - The array buffer to read.
  230. * @returns {number} The read orientation value.
  231. */function resetAndGetOrientation(arrayBuffer){var dataView=new DataView(arrayBuffer);var orientation;// Ignores range error when the image does not have correct Exif information
  232. try{var littleEndian;var app1Start;var ifdStart;// Only handle JPEG image (start by 0xFFD8)
  233. if(dataView.getUint8(0)===0xFF&&dataView.getUint8(1)===0xD8){var length=dataView.byteLength;var offset=2;while(offset+1<length){if(dataView.getUint8(offset)===0xFF&&dataView.getUint8(offset+1)===0xE1){app1Start=offset;break;}offset+=1;}}if(app1Start){var exifIDCode=app1Start+4;var tiffOffset=app1Start+10;if(getStringFromCharCode(dataView,exifIDCode,4)==='Exif'){var endianness=dataView.getUint16(tiffOffset);littleEndian=endianness===0x4949;if(littleEndian||endianness===0x4D4D/* bigEndian */){if(dataView.getUint16(tiffOffset+2,littleEndian)===0x002A){var firstIFDOffset=dataView.getUint32(tiffOffset+4,littleEndian);if(firstIFDOffset>=0x00000008){ifdStart=tiffOffset+firstIFDOffset;}}}}}if(ifdStart){var _length=dataView.getUint16(ifdStart,littleEndian);var _offset;var i;for(i=0;i<_length;i+=1){_offset=ifdStart+i*12+2;if(dataView.getUint16(_offset,littleEndian)===0x0112/* Orientation */){// 8 is the offset of the current tag's value
  234. _offset+=8;// Get the original orientation value
  235. orientation=dataView.getUint16(_offset,littleEndian);// Override the orientation with its default value
  236. dataView.setUint16(_offset,1,littleEndian);break;}}}}catch(error){orientation=1;}return orientation;}/**
  237. * Parse Exif Orientation value.
  238. * @param {number} orientation - The orientation to parse.
  239. * @returns {Object} The parsed result.
  240. */function parseOrientation(orientation){var rotate=0;var scaleX=1;var scaleY=1;switch(orientation){// Flip horizontal
  241. case 2:scaleX=-1;break;// Rotate left 180°
  242. case 3:rotate=-180;break;// Flip vertical
  243. case 4:scaleY=-1;break;// Flip vertical and rotate right 90°
  244. case 5:rotate=90;scaleY=-1;break;// Rotate right 90°
  245. case 6:rotate=90;break;// Flip horizontal and rotate right 90°
  246. case 7:rotate=90;scaleX=-1;break;// Rotate left 90°
  247. case 8:rotate=-90;break;}return{rotate:rotate,scaleX:scaleX,scaleY:scaleY};}var render={render:function render(){this.initContainer();this.initCanvas();this.initCropBox();this.renderCanvas();if(this.cropped){this.renderCropBox();}},initContainer:function initContainer(){var element=this.element,options=this.options,container=this.container,cropper=this.cropper;var minWidth=Number(options.minContainerWidth);var minHeight=Number(options.minContainerHeight);addClass(cropper,CLASS_HIDDEN);removeClass(element,CLASS_HIDDEN);var containerData={width:Math.max(container.offsetWidth,minWidth>=0?minWidth:MIN_CONTAINER_WIDTH),height:Math.max(container.offsetHeight,minHeight>=0?minHeight:MIN_CONTAINER_HEIGHT)};this.containerData=containerData;setStyle(cropper,{width:containerData.width,height:containerData.height});addClass(element,CLASS_HIDDEN);removeClass(cropper,CLASS_HIDDEN);},// Canvas (image wrapper)
  248. initCanvas:function initCanvas(){var containerData=this.containerData,imageData=this.imageData;var viewMode=this.options.viewMode;var rotated=Math.abs(imageData.rotate)%180===90;var naturalWidth=rotated?imageData.naturalHeight:imageData.naturalWidth;var naturalHeight=rotated?imageData.naturalWidth:imageData.naturalHeight;var aspectRatio=naturalWidth/naturalHeight;var canvasWidth=containerData.width;var canvasHeight=containerData.height;if(containerData.height*aspectRatio>containerData.width){if(viewMode===3){canvasWidth=containerData.height*aspectRatio;}else{canvasHeight=containerData.width/aspectRatio;}}else if(viewMode===3){canvasHeight=containerData.width/aspectRatio;}else{canvasWidth=containerData.height*aspectRatio;}var canvasData={aspectRatio:aspectRatio,naturalWidth:naturalWidth,naturalHeight:naturalHeight,width:canvasWidth,height:canvasHeight};this.canvasData=canvasData;this.limited=viewMode===1||viewMode===2;this.limitCanvas(true,true);canvasData.width=Math.min(Math.max(canvasData.width,canvasData.minWidth),canvasData.maxWidth);canvasData.height=Math.min(Math.max(canvasData.height,canvasData.minHeight),canvasData.maxHeight);canvasData.left=(containerData.width-canvasData.width)/2;canvasData.top=(containerData.height-canvasData.height)/2;canvasData.oldLeft=canvasData.left;canvasData.oldTop=canvasData.top;this.initialCanvasData=assign({},canvasData);},limitCanvas:function limitCanvas(sizeLimited,positionLimited){var options=this.options,containerData=this.containerData,canvasData=this.canvasData,cropBoxData=this.cropBoxData;var viewMode=options.viewMode;var aspectRatio=canvasData.aspectRatio;var cropped=this.cropped&&cropBoxData;if(sizeLimited){var minCanvasWidth=Number(options.minCanvasWidth)||0;var minCanvasHeight=Number(options.minCanvasHeight)||0;if(viewMode>1){minCanvasWidth=Math.max(minCanvasWidth,containerData.width);minCanvasHeight=Math.max(minCanvasHeight,containerData.height);if(viewMode===3){if(minCanvasHeight*aspectRatio>minCanvasWidth){minCanvasWidth=minCanvasHeight*aspectRatio;}else{minCanvasHeight=minCanvasWidth/aspectRatio;}}}else if(viewMode>0){if(minCanvasWidth){minCanvasWidth=Math.max(minCanvasWidth,cropped?cropBoxData.width:0);}else if(minCanvasHeight){minCanvasHeight=Math.max(minCanvasHeight,cropped?cropBoxData.height:0);}else if(cropped){minCanvasWidth=cropBoxData.width;minCanvasHeight=cropBoxData.height;if(minCanvasHeight*aspectRatio>minCanvasWidth){minCanvasWidth=minCanvasHeight*aspectRatio;}else{minCanvasHeight=minCanvasWidth/aspectRatio;}}}var _getAdjustedSizes=getAdjustedSizes({aspectRatio:aspectRatio,width:minCanvasWidth,height:minCanvasHeight});minCanvasWidth=_getAdjustedSizes.width;minCanvasHeight=_getAdjustedSizes.height;canvasData.minWidth=minCanvasWidth;canvasData.minHeight=minCanvasHeight;canvasData.maxWidth=Infinity;canvasData.maxHeight=Infinity;}if(positionLimited){if(viewMode>(cropped?0:1)){var newCanvasLeft=containerData.width-canvasData.width;var newCanvasTop=containerData.height-canvasData.height;canvasData.minLeft=Math.min(0,newCanvasLeft);canvasData.minTop=Math.min(0,newCanvasTop);canvasData.maxLeft=Math.max(0,newCanvasLeft);canvasData.maxTop=Math.max(0,newCanvasTop);if(cropped&&this.limited){canvasData.minLeft=Math.min(cropBoxData.left,cropBoxData.left+(cropBoxData.width-canvasData.width));canvasData.minTop=Math.min(cropBoxData.top,cropBoxData.top+(cropBoxData.height-canvasData.height));canvasData.maxLeft=cropBoxData.left;canvasData.maxTop=cropBoxData.top;if(viewMode===2){if(canvasData.width>=containerData.width){canvasData.minLeft=Math.min(0,newCanvasLeft);canvasData.maxLeft=Math.max(0,newCanvasLeft);}if(canvasData.height>=containerData.height){canvasData.minTop=Math.min(0,newCanvasTop);canvasData.maxTop=Math.max(0,newCanvasTop);}}}}else{canvasData.minLeft=-canvasData.width;canvasData.minTop=-canvasData.height;canvasData.maxLeft=containerData.width;canvasData.maxTop=containerData.height;}}},renderCanvas:function renderCanvas(changed,transformed){var canvasData=this.canvasData,imageData=this.imageData;if(transformed){var _getRotatedSizes=getRotatedSizes({width:imageData.naturalWidth*Math.abs(imageData.scaleX||1),height:imageData.naturalHeight*Math.abs(imageData.scaleY||1),degree:imageData.rotate||0}),naturalWidth=_getRotatedSizes.width,naturalHeight=_getRotatedSizes.height;var width=canvasData.width*(naturalWidth/canvasData.naturalWidth);var height=canvasData.height*(naturalHeight/canvasData.naturalHeight);canvasData.left-=(width-canvasData.width)/2;canvasData.top-=(height-canvasData.height)/2;canvasData.width=width;canvasData.height=height;canvasData.aspectRatio=naturalWidth/naturalHeight;canvasData.naturalWidth=naturalWidth;canvasData.naturalHeight=naturalHeight;this.limitCanvas(true,false);}if(canvasData.width>canvasData.maxWidth||canvasData.width<canvasData.minWidth){canvasData.left=canvasData.oldLeft;}if(canvasData.height>canvasData.maxHeight||canvasData.height<canvasData.minHeight){canvasData.top=canvasData.oldTop;}canvasData.width=Math.min(Math.max(canvasData.width,canvasData.minWidth),canvasData.maxWidth);canvasData.height=Math.min(Math.max(canvasData.height,canvasData.minHeight),canvasData.maxHeight);this.limitCanvas(false,true);canvasData.left=Math.min(Math.max(canvasData.left,canvasData.minLeft),canvasData.maxLeft);canvasData.top=Math.min(Math.max(canvasData.top,canvasData.minTop),canvasData.maxTop);canvasData.oldLeft=canvasData.left;canvasData.oldTop=canvasData.top;setStyle(this.canvas,assign({width:canvasData.width,height:canvasData.height},getTransforms({translateX:canvasData.left,translateY:canvasData.top})));this.renderImage(changed);if(this.cropped&&this.limited){this.limitCropBox(true,true);}},renderImage:function renderImage(changed){var canvasData=this.canvasData,imageData=this.imageData;var width=imageData.naturalWidth*(canvasData.width/canvasData.naturalWidth);var height=imageData.naturalHeight*(canvasData.height/canvasData.naturalHeight);assign(imageData,{width:width,height:height,left:(canvasData.width-width)/2,top:(canvasData.height-height)/2});setStyle(this.image,assign({width:imageData.width,height:imageData.height},getTransforms(assign({translateX:imageData.left,translateY:imageData.top},imageData))));if(changed){this.output();}},initCropBox:function initCropBox(){var options=this.options,canvasData=this.canvasData;var aspectRatio=options.aspectRatio||options.initialAspectRatio;var autoCropArea=Number(options.autoCropArea)||0.8;var cropBoxData={width:canvasData.width,height:canvasData.height};if(aspectRatio){if(canvasData.height*aspectRatio>canvasData.width){cropBoxData.height=cropBoxData.width/aspectRatio;}else{cropBoxData.width=cropBoxData.height*aspectRatio;}}this.cropBoxData=cropBoxData;this.limitCropBox(true,true);// Initialize auto crop area
  249. cropBoxData.width=Math.min(Math.max(cropBoxData.width,cropBoxData.minWidth),cropBoxData.maxWidth);cropBoxData.height=Math.min(Math.max(cropBoxData.height,cropBoxData.minHeight),cropBoxData.maxHeight);// The width/height of auto crop area must large than "minWidth/Height"
  250. cropBoxData.width=Math.max(cropBoxData.minWidth,cropBoxData.width*autoCropArea);cropBoxData.height=Math.max(cropBoxData.minHeight,cropBoxData.height*autoCropArea);cropBoxData.left=canvasData.left+(canvasData.width-cropBoxData.width)/2;cropBoxData.top=canvasData.top+(canvasData.height-cropBoxData.height)/2;cropBoxData.oldLeft=cropBoxData.left;cropBoxData.oldTop=cropBoxData.top;this.initialCropBoxData=assign({},cropBoxData);},limitCropBox:function limitCropBox(sizeLimited,positionLimited){var options=this.options,containerData=this.containerData,canvasData=this.canvasData,cropBoxData=this.cropBoxData,limited=this.limited;var aspectRatio=options.aspectRatio;if(sizeLimited){var minCropBoxWidth=Number(options.minCropBoxWidth)||0;var minCropBoxHeight=Number(options.minCropBoxHeight)||0;var maxCropBoxWidth=limited?Math.min(containerData.width,canvasData.width,canvasData.width+canvasData.left,containerData.width-canvasData.left):containerData.width;var maxCropBoxHeight=limited?Math.min(containerData.height,canvasData.height,canvasData.height+canvasData.top,containerData.height-canvasData.top):containerData.height;// The min/maxCropBoxWidth/Height must be less than container's width/height
  251. minCropBoxWidth=Math.min(minCropBoxWidth,containerData.width);minCropBoxHeight=Math.min(minCropBoxHeight,containerData.height);if(aspectRatio){if(minCropBoxWidth&&minCropBoxHeight){if(minCropBoxHeight*aspectRatio>minCropBoxWidth){minCropBoxHeight=minCropBoxWidth/aspectRatio;}else{minCropBoxWidth=minCropBoxHeight*aspectRatio;}}else if(minCropBoxWidth){minCropBoxHeight=minCropBoxWidth/aspectRatio;}else if(minCropBoxHeight){minCropBoxWidth=minCropBoxHeight*aspectRatio;}if(maxCropBoxHeight*aspectRatio>maxCropBoxWidth){maxCropBoxHeight=maxCropBoxWidth/aspectRatio;}else{maxCropBoxWidth=maxCropBoxHeight*aspectRatio;}}// The minWidth/Height must be less than maxWidth/Height
  252. cropBoxData.minWidth=Math.min(minCropBoxWidth,maxCropBoxWidth);cropBoxData.minHeight=Math.min(minCropBoxHeight,maxCropBoxHeight);cropBoxData.maxWidth=maxCropBoxWidth;cropBoxData.maxHeight=maxCropBoxHeight;}if(positionLimited){if(limited){cropBoxData.minLeft=Math.max(0,canvasData.left);cropBoxData.minTop=Math.max(0,canvasData.top);cropBoxData.maxLeft=Math.min(containerData.width,canvasData.left+canvasData.width)-cropBoxData.width;cropBoxData.maxTop=Math.min(containerData.height,canvasData.top+canvasData.height)-cropBoxData.height;}else{cropBoxData.minLeft=0;cropBoxData.minTop=0;cropBoxData.maxLeft=containerData.width-cropBoxData.width;cropBoxData.maxTop=containerData.height-cropBoxData.height;}}},renderCropBox:function renderCropBox(){var options=this.options,containerData=this.containerData,cropBoxData=this.cropBoxData;if(cropBoxData.width>cropBoxData.maxWidth||cropBoxData.width<cropBoxData.minWidth){cropBoxData.left=cropBoxData.oldLeft;}if(cropBoxData.height>cropBoxData.maxHeight||cropBoxData.height<cropBoxData.minHeight){cropBoxData.top=cropBoxData.oldTop;}cropBoxData.width=Math.min(Math.max(cropBoxData.width,cropBoxData.minWidth),cropBoxData.maxWidth);cropBoxData.height=Math.min(Math.max(cropBoxData.height,cropBoxData.minHeight),cropBoxData.maxHeight);this.limitCropBox(false,true);cropBoxData.left=Math.min(Math.max(cropBoxData.left,cropBoxData.minLeft),cropBoxData.maxLeft);cropBoxData.top=Math.min(Math.max(cropBoxData.top,cropBoxData.minTop),cropBoxData.maxTop);cropBoxData.oldLeft=cropBoxData.left;cropBoxData.oldTop=cropBoxData.top;if(options.movable&&options.cropBoxMovable){// Turn to move the canvas when the crop box is equal to the container
  253. setData(this.face,DATA_ACTION,cropBoxData.width>=containerData.width&&cropBoxData.height>=containerData.height?ACTION_MOVE:ACTION_ALL);}setStyle(this.cropBox,assign({width:cropBoxData.width,height:cropBoxData.height},getTransforms({translateX:cropBoxData.left,translateY:cropBoxData.top})));if(this.cropped&&this.limited){this.limitCanvas(true,true);}if(!this.disabled){this.output();}},output:function output(){this.preview();dispatchEvent(this.element,EVENT_CROP,this.getData());}};var preview={initPreview:function initPreview(){var element=this.element,crossOrigin=this.crossOrigin;var preview=this.options.preview;var url=crossOrigin?this.crossOriginUrl:this.url;var alt=element.alt||'The image to preview';var image=document.createElement('img');if(crossOrigin){image.crossOrigin=crossOrigin;}image.src=url;image.alt=alt;this.viewBox.appendChild(image);this.viewBoxImage=image;if(!preview){return;}var previews=preview;if(typeof preview==='string'){previews=element.ownerDocument.querySelectorAll(preview);}else if(preview.querySelector){previews=[preview];}this.previews=previews;forEach(previews,function(el){var img=document.createElement('img');// Save the original size for recover
  254. setData(el,DATA_PREVIEW,{width:el.offsetWidth,height:el.offsetHeight,html:el.innerHTML});if(crossOrigin){img.crossOrigin=crossOrigin;}img.src=url;img.alt=alt;/**
  255. * Override img element styles
  256. * Add `display:block` to avoid margin top issue
  257. * Add `height:auto` to override `height` attribute on IE8
  258. * (Occur only when margin-top <= -height)
  259. */img.style.cssText='display:block;'+'width:100%;'+'height:auto;'+'min-width:0!important;'+'min-height:0!important;'+'max-width:none!important;'+'max-height:none!important;'+'image-orientation:0deg!important;"';el.innerHTML='';el.appendChild(img);});},resetPreview:function resetPreview(){forEach(this.previews,function(element){var data=getData(element,DATA_PREVIEW);setStyle(element,{width:data.width,height:data.height});element.innerHTML=data.html;removeData(element,DATA_PREVIEW);});},preview:function preview(){var imageData=this.imageData,canvasData=this.canvasData,cropBoxData=this.cropBoxData;var cropBoxWidth=cropBoxData.width,cropBoxHeight=cropBoxData.height;var width=imageData.width,height=imageData.height;var left=cropBoxData.left-canvasData.left-imageData.left;var top=cropBoxData.top-canvasData.top-imageData.top;if(!this.cropped||this.disabled){return;}setStyle(this.viewBoxImage,assign({width:width,height:height},getTransforms(assign({translateX:-left,translateY:-top},imageData))));forEach(this.previews,function(element){var data=getData(element,DATA_PREVIEW);var originalWidth=data.width;var originalHeight=data.height;var newWidth=originalWidth;var newHeight=originalHeight;var ratio=1;if(cropBoxWidth){ratio=originalWidth/cropBoxWidth;newHeight=cropBoxHeight*ratio;}if(cropBoxHeight&&newHeight>originalHeight){ratio=originalHeight/cropBoxHeight;newWidth=cropBoxWidth*ratio;newHeight=originalHeight;}setStyle(element,{width:newWidth,height:newHeight});setStyle(element.getElementsByTagName('img')[0],assign({width:width*ratio,height:height*ratio},getTransforms(assign({translateX:-left*ratio,translateY:-top*ratio},imageData))));});}};var events={bind:function bind(){var element=this.element,options=this.options,cropper=this.cropper;if(isFunction(options.cropstart)){addListener(element,EVENT_CROP_START,options.cropstart);}if(isFunction(options.cropmove)){addListener(element,EVENT_CROP_MOVE,options.cropmove);}if(isFunction(options.cropend)){addListener(element,EVENT_CROP_END,options.cropend);}if(isFunction(options.crop)){addListener(element,EVENT_CROP,options.crop);}if(isFunction(options.zoom)){addListener(element,EVENT_ZOOM,options.zoom);}addListener(cropper,EVENT_POINTER_DOWN,this.onCropStart=this.cropStart.bind(this));if(options.zoomable&&options.zoomOnWheel){addListener(cropper,EVENT_WHEEL,this.onWheel=this.wheel.bind(this),{passive:false,capture:true});}if(options.toggleDragModeOnDblclick){addListener(cropper,EVENT_DBLCLICK,this.onDblclick=this.dblclick.bind(this));}addListener(element.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove=this.cropMove.bind(this));addListener(element.ownerDocument,EVENT_POINTER_UP,this.onCropEnd=this.cropEnd.bind(this));if(options.responsive){addListener(window,EVENT_RESIZE,this.onResize=this.resize.bind(this));}},unbind:function unbind(){var element=this.element,options=this.options,cropper=this.cropper;if(isFunction(options.cropstart)){removeListener(element,EVENT_CROP_START,options.cropstart);}if(isFunction(options.cropmove)){removeListener(element,EVENT_CROP_MOVE,options.cropmove);}if(isFunction(options.cropend)){removeListener(element,EVENT_CROP_END,options.cropend);}if(isFunction(options.crop)){removeListener(element,EVENT_CROP,options.crop);}if(isFunction(options.zoom)){removeListener(element,EVENT_ZOOM,options.zoom);}removeListener(cropper,EVENT_POINTER_DOWN,this.onCropStart);if(options.zoomable&&options.zoomOnWheel){removeListener(cropper,EVENT_WHEEL,this.onWheel,{passive:false,capture:true});}if(options.toggleDragModeOnDblclick){removeListener(cropper,EVENT_DBLCLICK,this.onDblclick);}removeListener(element.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove);removeListener(element.ownerDocument,EVENT_POINTER_UP,this.onCropEnd);if(options.responsive){removeListener(window,EVENT_RESIZE,this.onResize);}}};var handlers={resize:function resize(){if(this.disabled){return;}var options=this.options,container=this.container,containerData=this.containerData;var ratioX=container.offsetWidth/containerData.width;var ratioY=container.offsetHeight/containerData.height;var ratio=Math.abs(ratioX-1)>Math.abs(ratioY-1)?ratioX:ratioY;// Resize when width changed or height changed
  260. if(ratio!==1){var canvasData;var cropBoxData;if(options.restore){canvasData=this.getCanvasData();cropBoxData=this.getCropBoxData();}this.render();if(options.restore){this.setCanvasData(forEach(canvasData,function(n,i){canvasData[i]=n*ratio;}));this.setCropBoxData(forEach(cropBoxData,function(n,i){cropBoxData[i]=n*ratio;}));}}},dblclick:function dblclick(){if(this.disabled||this.options.dragMode===DRAG_MODE_NONE){return;}this.setDragMode(hasClass(this.dragBox,CLASS_CROP)?DRAG_MODE_MOVE:DRAG_MODE_CROP);},wheel:function wheel(event){var _this=this;var ratio=Number(this.options.wheelZoomRatio)||0.1;var delta=1;if(this.disabled){return;}event.preventDefault();// Limit wheel speed to prevent zoom too fast (#21)
  261. if(this.wheeling){return;}this.wheeling=true;setTimeout(function(){_this.wheeling=false;},50);if(event.deltaY){delta=event.deltaY>0?1:-1;}else if(event.wheelDelta){delta=-event.wheelDelta/120;}else if(event.detail){delta=event.detail>0?1:-1;}this.zoom(-delta*ratio,event);},cropStart:function cropStart(event){var buttons=event.buttons,button=event.button;if(this.disabled// Handle mouse event and pointer event and ignore touch event
  262. ||(event.type==='mousedown'||event.type==='pointerdown'&&event.pointerType==='mouse')&&(// No primary button (Usually the left button)
  263. isNumber(buttons)&&buttons!==1||isNumber(button)&&button!==0// Open context menu
  264. ||event.ctrlKey)){return;}var options=this.options,pointers=this.pointers;var action;if(event.changedTouches){// Handle touch event
  265. forEach(event.changedTouches,function(touch){pointers[touch.identifier]=getPointer(touch);});}else{// Handle mouse event and pointer event
  266. pointers[event.pointerId||0]=getPointer(event);}if(Object.keys(pointers).length>1&&options.zoomable&&options.zoomOnTouch){action=ACTION_ZOOM;}else{action=getData(event.target,DATA_ACTION);}if(!REGEXP_ACTIONS.test(action)){return;}if(dispatchEvent(this.element,EVENT_CROP_START,{originalEvent:event,action:action})===false){return;}// This line is required for preventing page zooming in iOS browsers
  267. event.preventDefault();this.action=action;this.cropping=false;if(action===ACTION_CROP){this.cropping=true;addClass(this.dragBox,CLASS_MODAL);}},cropMove:function cropMove(event){var action=this.action;if(this.disabled||!action){return;}var pointers=this.pointers;event.preventDefault();if(dispatchEvent(this.element,EVENT_CROP_MOVE,{originalEvent:event,action:action})===false){return;}if(event.changedTouches){forEach(event.changedTouches,function(touch){// The first parameter should not be undefined (#432)
  268. assign(pointers[touch.identifier]||{},getPointer(touch,true));});}else{assign(pointers[event.pointerId||0]||{},getPointer(event,true));}this.change(event);},cropEnd:function cropEnd(event){if(this.disabled){return;}var action=this.action,pointers=this.pointers;if(event.changedTouches){forEach(event.changedTouches,function(touch){delete pointers[touch.identifier];});}else{delete pointers[event.pointerId||0];}if(!action){return;}event.preventDefault();if(!Object.keys(pointers).length){this.action='';}if(this.cropping){this.cropping=false;toggleClass(this.dragBox,CLASS_MODAL,this.cropped&&this.options.modal);}dispatchEvent(this.element,EVENT_CROP_END,{originalEvent:event,action:action});}};var change={change:function change(event){var options=this.options,canvasData=this.canvasData,containerData=this.containerData,cropBoxData=this.cropBoxData,pointers=this.pointers;var action=this.action;var aspectRatio=options.aspectRatio;var left=cropBoxData.left,top=cropBoxData.top,width=cropBoxData.width,height=cropBoxData.height;var right=left+width;var bottom=top+height;var minLeft=0;var minTop=0;var maxWidth=containerData.width;var maxHeight=containerData.height;var renderable=true;var offset;// Locking aspect ratio in "free mode" by holding shift key
  269. if(!aspectRatio&&event.shiftKey){aspectRatio=width&&height?width/height:1;}if(this.limited){minLeft=cropBoxData.minLeft;minTop=cropBoxData.minTop;maxWidth=minLeft+Math.min(containerData.width,canvasData.width,canvasData.left+canvasData.width);maxHeight=minTop+Math.min(containerData.height,canvasData.height,canvasData.top+canvasData.height);}var pointer=pointers[Object.keys(pointers)[0]];var range={x:pointer.endX-pointer.startX,y:pointer.endY-pointer.startY};var check=function check(side){switch(side){case ACTION_EAST:if(right+range.x>maxWidth){range.x=maxWidth-right;}break;case ACTION_WEST:if(left+range.x<minLeft){range.x=minLeft-left;}break;case ACTION_NORTH:if(top+range.y<minTop){range.y=minTop-top;}break;case ACTION_SOUTH:if(bottom+range.y>maxHeight){range.y=maxHeight-bottom;}break;}};switch(action){// Move crop box
  270. case ACTION_ALL:left+=range.x;top+=range.y;break;// Resize crop box
  271. case ACTION_EAST:if(range.x>=0&&(right>=maxWidth||aspectRatio&&(top<=minTop||bottom>=maxHeight))){renderable=false;break;}check(ACTION_EAST);width+=range.x;if(width<0){action=ACTION_WEST;width=-width;left-=width;}if(aspectRatio){height=width/aspectRatio;top+=(cropBoxData.height-height)/2;}break;case ACTION_NORTH:if(range.y<=0&&(top<=minTop||aspectRatio&&(left<=minLeft||right>=maxWidth))){renderable=false;break;}check(ACTION_NORTH);height-=range.y;top+=range.y;if(height<0){action=ACTION_SOUTH;height=-height;top-=height;}if(aspectRatio){width=height*aspectRatio;left+=(cropBoxData.width-width)/2;}break;case ACTION_WEST:if(range.x<=0&&(left<=minLeft||aspectRatio&&(top<=minTop||bottom>=maxHeight))){renderable=false;break;}check(ACTION_WEST);width-=range.x;left+=range.x;if(width<0){action=ACTION_EAST;width=-width;left-=width;}if(aspectRatio){height=width/aspectRatio;top+=(cropBoxData.height-height)/2;}break;case ACTION_SOUTH:if(range.y>=0&&(bottom>=maxHeight||aspectRatio&&(left<=minLeft||right>=maxWidth))){renderable=false;break;}check(ACTION_SOUTH);height+=range.y;if(height<0){action=ACTION_NORTH;height=-height;top-=height;}if(aspectRatio){width=height*aspectRatio;left+=(cropBoxData.width-width)/2;}break;case ACTION_NORTH_EAST:if(aspectRatio){if(range.y<=0&&(top<=minTop||right>=maxWidth)){renderable=false;break;}check(ACTION_NORTH);height-=range.y;top+=range.y;width=height*aspectRatio;}else{check(ACTION_NORTH);check(ACTION_EAST);if(range.x>=0){if(right<maxWidth){width+=range.x;}else if(range.y<=0&&top<=minTop){renderable=false;}}else{width+=range.x;}if(range.y<=0){if(top>minTop){height-=range.y;top+=range.y;}}else{height-=range.y;top+=range.y;}}if(width<0&&height<0){action=ACTION_SOUTH_WEST;height=-height;width=-width;top-=height;left-=width;}else if(width<0){action=ACTION_NORTH_WEST;width=-width;left-=width;}else if(height<0){action=ACTION_SOUTH_EAST;height=-height;top-=height;}break;case ACTION_NORTH_WEST:if(aspectRatio){if(range.y<=0&&(top<=minTop||left<=minLeft)){renderable=false;break;}check(ACTION_NORTH);height-=range.y;top+=range.y;width=height*aspectRatio;left+=cropBoxData.width-width;}else{check(ACTION_NORTH);check(ACTION_WEST);if(range.x<=0){if(left>minLeft){width-=range.x;left+=range.x;}else if(range.y<=0&&top<=minTop){renderable=false;}}else{width-=range.x;left+=range.x;}if(range.y<=0){if(top>minTop){height-=range.y;top+=range.y;}}else{height-=range.y;top+=range.y;}}if(width<0&&height<0){action=ACTION_SOUTH_EAST;height=-height;width=-width;top-=height;left-=width;}else if(width<0){action=ACTION_NORTH_EAST;width=-width;left-=width;}else if(height<0){action=ACTION_SOUTH_WEST;height=-height;top-=height;}break;case ACTION_SOUTH_WEST:if(aspectRatio){if(range.x<=0&&(left<=minLeft||bottom>=maxHeight)){renderable=false;break;}check(ACTION_WEST);width-=range.x;left+=range.x;height=width/aspectRatio;}else{check(ACTION_SOUTH);check(ACTION_WEST);if(range.x<=0){if(left>minLeft){width-=range.x;left+=range.x;}else if(range.y>=0&&bottom>=maxHeight){renderable=false;}}else{width-=range.x;left+=range.x;}if(range.y>=0){if(bottom<maxHeight){height+=range.y;}}else{height+=range.y;}}if(width<0&&height<0){action=ACTION_NORTH_EAST;height=-height;width=-width;top-=height;left-=width;}else if(width<0){action=ACTION_SOUTH_EAST;width=-width;left-=width;}else if(height<0){action=ACTION_NORTH_WEST;height=-height;top-=height;}break;case ACTION_SOUTH_EAST:if(aspectRatio){if(range.x>=0&&(right>=maxWidth||bottom>=maxHeight)){renderable=false;break;}check(ACTION_EAST);width+=range.x;height=width/aspectRatio;}else{check(ACTION_SOUTH);check(ACTION_EAST);if(range.x>=0){if(right<maxWidth){width+=range.x;}else if(range.y>=0&&bottom>=maxHeight){renderable=false;}}else{width+=range.x;}if(range.y>=0){if(bottom<maxHeight){height+=range.y;}}else{height+=range.y;}}if(width<0&&height<0){action=ACTION_NORTH_WEST;height=-height;width=-width;top-=height;left-=width;}else if(width<0){action=ACTION_SOUTH_WEST;width=-width;left-=width;}else if(height<0){action=ACTION_NORTH_EAST;height=-height;top-=height;}break;// Move canvas
  272. case ACTION_MOVE:this.move(range.x,range.y);renderable=false;break;// Zoom canvas
  273. case ACTION_ZOOM:this.zoom(getMaxZoomRatio(pointers),event);renderable=false;break;// Create crop box
  274. case ACTION_CROP:if(!range.x||!range.y){renderable=false;break;}offset=getOffset(this.cropper);left=pointer.startX-offset.left;top=pointer.startY-offset.top;width=cropBoxData.minWidth;height=cropBoxData.minHeight;if(range.x>0){action=range.y>0?ACTION_SOUTH_EAST:ACTION_NORTH_EAST;}else if(range.x<0){left-=width;action=range.y>0?ACTION_SOUTH_WEST:ACTION_NORTH_WEST;}if(range.y<0){top-=height;}// Show the crop box if is hidden
  275. if(!this.cropped){removeClass(this.cropBox,CLASS_HIDDEN);this.cropped=true;if(this.limited){this.limitCropBox(true,true);}}break;}if(renderable){cropBoxData.width=width;cropBoxData.height=height;cropBoxData.left=left;cropBoxData.top=top;this.action=action;this.renderCropBox();}// Override
  276. forEach(pointers,function(p){p.startX=p.endX;p.startY=p.endY;});}};var methods={// Show the crop box manually
  277. crop:function crop(){if(this.ready&&!this.cropped&&!this.disabled){this.cropped=true;this.limitCropBox(true,true);if(this.options.modal){addClass(this.dragBox,CLASS_MODAL);}removeClass(this.cropBox,CLASS_HIDDEN);this.setCropBoxData(this.initialCropBoxData);}return this;},// Reset the image and crop box to their initial states
  278. reset:function reset(){if(this.ready&&!this.disabled){this.imageData=assign({},this.initialImageData);this.canvasData=assign({},this.initialCanvasData);this.cropBoxData=assign({},this.initialCropBoxData);this.renderCanvas();if(this.cropped){this.renderCropBox();}}return this;},// Clear the crop box
  279. clear:function clear(){if(this.cropped&&!this.disabled){assign(this.cropBoxData,{left:0,top:0,width:0,height:0});this.cropped=false;this.renderCropBox();this.limitCanvas(true,true);// Render canvas after crop box rendered
  280. this.renderCanvas();removeClass(this.dragBox,CLASS_MODAL);addClass(this.cropBox,CLASS_HIDDEN);}return this;},/**
  281. * Replace the image's src and rebuild the cropper
  282. * @param {string} url - The new URL.
  283. * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.
  284. * @returns {Cropper} this
  285. */replace:function replace(url){var hasSameSize=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!this.disabled&&url){if(this.isImg){this.element.src=url;}if(hasSameSize){this.url=url;this.image.src=url;if(this.ready){this.viewBoxImage.src=url;forEach(this.previews,function(element){element.getElementsByTagName('img')[0].src=url;});}}else{if(this.isImg){this.replaced=true;}this.options.data=null;this.uncreate();this.load(url);}}return this;},// Enable (unfreeze) the cropper
  286. enable:function enable(){if(this.ready&&this.disabled){this.disabled=false;removeClass(this.cropper,CLASS_DISABLED);}return this;},// Disable (freeze) the cropper
  287. disable:function disable(){if(this.ready&&!this.disabled){this.disabled=true;addClass(this.cropper,CLASS_DISABLED);}return this;},/**
  288. * Destroy the cropper and remove the instance from the image
  289. * @returns {Cropper} this
  290. */destroy:function destroy(){var element=this.element;if(!element[NAMESPACE]){return this;}element[NAMESPACE]=undefined;if(this.isImg&&this.replaced){element.src=this.originalUrl;}this.uncreate();return this;},/**
  291. * Move the canvas with relative offsets
  292. * @param {number} offsetX - The relative offset distance on the x-axis.
  293. * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.
  294. * @returns {Cropper} this
  295. */move:function move(offsetX){var offsetY=arguments.length>1&&arguments[1]!==undefined?arguments[1]:offsetX;var _this$canvasData=this.canvasData,left=_this$canvasData.left,top=_this$canvasData.top;return this.moveTo(isUndefined(offsetX)?offsetX:left+Number(offsetX),isUndefined(offsetY)?offsetY:top+Number(offsetY));},/**
  296. * Move the canvas to an absolute point
  297. * @param {number} x - The x-axis coordinate.
  298. * @param {number} [y=x] - The y-axis coordinate.
  299. * @returns {Cropper} this
  300. */moveTo:function moveTo(x){var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:x;var canvasData=this.canvasData;var changed=false;x=Number(x);y=Number(y);if(this.ready&&!this.disabled&&this.options.movable){if(isNumber(x)){canvasData.left=x;changed=true;}if(isNumber(y)){canvasData.top=y;changed=true;}if(changed){this.renderCanvas(true);}}return this;},/**
  301. * Zoom the canvas with a relative ratio
  302. * @param {number} ratio - The target ratio.
  303. * @param {Event} _originalEvent - The original event if any.
  304. * @returns {Cropper} this
  305. */zoom:function zoom(ratio,_originalEvent){var canvasData=this.canvasData;ratio=Number(ratio);if(ratio<0){ratio=1/(1-ratio);}else{ratio=1+ratio;}return this.zoomTo(canvasData.width*ratio/canvasData.naturalWidth,null,_originalEvent);},/**
  306. * Zoom the canvas to an absolute ratio
  307. * @param {number} ratio - The target ratio.
  308. * @param {Object} pivot - The zoom pivot point coordinate.
  309. * @param {Event} _originalEvent - The original event if any.
  310. * @returns {Cropper} this
  311. */zoomTo:function zoomTo(ratio,pivot,_originalEvent){var options=this.options,canvasData=this.canvasData;var width=canvasData.width,height=canvasData.height,naturalWidth=canvasData.naturalWidth,naturalHeight=canvasData.naturalHeight;ratio=Number(ratio);if(ratio>=0&&this.ready&&!this.disabled&&options.zoomable){var newWidth=naturalWidth*ratio;var newHeight=naturalHeight*ratio;if(dispatchEvent(this.element,EVENT_ZOOM,{ratio:ratio,oldRatio:width/naturalWidth,originalEvent:_originalEvent})===false){return this;}if(_originalEvent){var pointers=this.pointers;var offset=getOffset(this.cropper);var center=pointers&&Object.keys(pointers).length?getPointersCenter(pointers):{pageX:_originalEvent.pageX,pageY:_originalEvent.pageY};// Zoom from the triggering point of the event
  312. canvasData.left-=(newWidth-width)*((center.pageX-offset.left-canvasData.left)/width);canvasData.top-=(newHeight-height)*((center.pageY-offset.top-canvasData.top)/height);}else if(isPlainObject(pivot)&&isNumber(pivot.x)&&isNumber(pivot.y)){canvasData.left-=(newWidth-width)*((pivot.x-canvasData.left)/width);canvasData.top-=(newHeight-height)*((pivot.y-canvasData.top)/height);}else{// Zoom from the center of the canvas
  313. canvasData.left-=(newWidth-width)/2;canvasData.top-=(newHeight-height)/2;}canvasData.width=newWidth;canvasData.height=newHeight;this.renderCanvas(true);}return this;},/**
  314. * Rotate the canvas with a relative degree
  315. * @param {number} degree - The rotate degree.
  316. * @returns {Cropper} this
  317. */rotate:function rotate(degree){return this.rotateTo((this.imageData.rotate||0)+Number(degree));},/**
  318. * Rotate the canvas to an absolute degree
  319. * @param {number} degree - The rotate degree.
  320. * @returns {Cropper} this
  321. */rotateTo:function rotateTo(degree){degree=Number(degree);if(isNumber(degree)&&this.ready&&!this.disabled&&this.options.rotatable){this.imageData.rotate=degree%360;this.renderCanvas(true,true);}return this;},/**
  322. * Scale the image on the x-axis.
  323. * @param {number} scaleX - The scale ratio on the x-axis.
  324. * @returns {Cropper} this
  325. */scaleX:function scaleX(_scaleX){var scaleY=this.imageData.scaleY;return this.scale(_scaleX,isNumber(scaleY)?scaleY:1);},/**
  326. * Scale the image on the y-axis.
  327. * @param {number} scaleY - The scale ratio on the y-axis.
  328. * @returns {Cropper} this
  329. */scaleY:function scaleY(_scaleY){var scaleX=this.imageData.scaleX;return this.scale(isNumber(scaleX)?scaleX:1,_scaleY);},/**
  330. * Scale the image
  331. * @param {number} scaleX - The scale ratio on the x-axis.
  332. * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
  333. * @returns {Cropper} this
  334. */scale:function scale(scaleX){var scaleY=arguments.length>1&&arguments[1]!==undefined?arguments[1]:scaleX;var imageData=this.imageData;var transformed=false;scaleX=Number(scaleX);scaleY=Number(scaleY);if(this.ready&&!this.disabled&&this.options.scalable){if(isNumber(scaleX)){imageData.scaleX=scaleX;transformed=true;}if(isNumber(scaleY)){imageData.scaleY=scaleY;transformed=true;}if(transformed){this.renderCanvas(true,true);}}return this;},/**
  335. * Get the cropped area position and size data (base on the original image)
  336. * @param {boolean} [rounded=false] - Indicate if round the data values or not.
  337. * @returns {Object} The result cropped data.
  338. */getData:function getData(){var rounded=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var options=this.options,imageData=this.imageData,canvasData=this.canvasData,cropBoxData=this.cropBoxData;var data;if(this.ready&&this.cropped){data={x:cropBoxData.left-canvasData.left,y:cropBoxData.top-canvasData.top,width:cropBoxData.width,height:cropBoxData.height};var ratio=imageData.width/imageData.naturalWidth;forEach(data,function(n,i){data[i]=n/ratio;});if(rounded){// In case rounding off leads to extra 1px in right or bottom border
  339. // we should round the top-left corner and the dimension (#343).
  340. var bottom=Math.round(data.y+data.height);var right=Math.round(data.x+data.width);data.x=Math.round(data.x);data.y=Math.round(data.y);data.width=right-data.x;data.height=bottom-data.y;}}else{data={x:0,y:0,width:0,height:0};}if(options.rotatable){data.rotate=imageData.rotate||0;}if(options.scalable){data.scaleX=imageData.scaleX||1;data.scaleY=imageData.scaleY||1;}return data;},/**
  341. * Set the cropped area position and size with new data
  342. * @param {Object} data - The new data.
  343. * @returns {Cropper} this
  344. */setData:function setData(data){var options=this.options,imageData=this.imageData,canvasData=this.canvasData;var cropBoxData={};if(this.ready&&!this.disabled&&isPlainObject(data)){var transformed=false;if(options.rotatable){if(isNumber(data.rotate)&&data.rotate!==imageData.rotate){imageData.rotate=data.rotate;transformed=true;}}if(options.scalable){if(isNumber(data.scaleX)&&data.scaleX!==imageData.scaleX){imageData.scaleX=data.scaleX;transformed=true;}if(isNumber(data.scaleY)&&data.scaleY!==imageData.scaleY){imageData.scaleY=data.scaleY;transformed=true;}}if(transformed){this.renderCanvas(true,true);}var ratio=imageData.width/imageData.naturalWidth;if(isNumber(data.x)){cropBoxData.left=data.x*ratio+canvasData.left;}if(isNumber(data.y)){cropBoxData.top=data.y*ratio+canvasData.top;}if(isNumber(data.width)){cropBoxData.width=data.width*ratio;}if(isNumber(data.height)){cropBoxData.height=data.height*ratio;}this.setCropBoxData(cropBoxData);}return this;},/**
  345. * Get the container size data.
  346. * @returns {Object} The result container data.
  347. */getContainerData:function getContainerData(){return this.ready?assign({},this.containerData):{};},/**
  348. * Get the image position and size data.
  349. * @returns {Object} The result image data.
  350. */getImageData:function getImageData(){return this.sized?assign({},this.imageData):{};},/**
  351. * Get the canvas position and size data.
  352. * @returns {Object} The result canvas data.
  353. */getCanvasData:function getCanvasData(){var canvasData=this.canvasData;var data={};if(this.ready){forEach(['left','top','width','height','naturalWidth','naturalHeight'],function(n){data[n]=canvasData[n];});}return data;},/**
  354. * Set the canvas position and size with new data.
  355. * @param {Object} data - The new canvas data.
  356. * @returns {Cropper} this
  357. */setCanvasData:function setCanvasData(data){var canvasData=this.canvasData;var aspectRatio=canvasData.aspectRatio;if(this.ready&&!this.disabled&&isPlainObject(data)){if(isNumber(data.left)){canvasData.left=data.left;}if(isNumber(data.top)){canvasData.top=data.top;}if(isNumber(data.width)){canvasData.width=data.width;canvasData.height=data.width/aspectRatio;}else if(isNumber(data.height)){canvasData.height=data.height;canvasData.width=data.height*aspectRatio;}this.renderCanvas(true);}return this;},/**
  358. * Get the crop box position and size data.
  359. * @returns {Object} The result crop box data.
  360. */getCropBoxData:function getCropBoxData(){var cropBoxData=this.cropBoxData;var data;if(this.ready&&this.cropped){data={left:cropBoxData.left,top:cropBoxData.top,width:cropBoxData.width,height:cropBoxData.height};}return data||{};},/**
  361. * Set the crop box position and size with new data.
  362. * @param {Object} data - The new crop box data.
  363. * @returns {Cropper} this
  364. */setCropBoxData:function setCropBoxData(data){var cropBoxData=this.cropBoxData;var aspectRatio=this.options.aspectRatio;var widthChanged;var heightChanged;if(this.ready&&this.cropped&&!this.disabled&&isPlainObject(data)){if(isNumber(data.left)){cropBoxData.left=data.left;}if(isNumber(data.top)){cropBoxData.top=data.top;}if(isNumber(data.width)&&data.width!==cropBoxData.width){widthChanged=true;cropBoxData.width=data.width;}if(isNumber(data.height)&&data.height!==cropBoxData.height){heightChanged=true;cropBoxData.height=data.height;}if(aspectRatio){if(widthChanged){cropBoxData.height=cropBoxData.width/aspectRatio;}else if(heightChanged){cropBoxData.width=cropBoxData.height*aspectRatio;}}this.renderCropBox();}return this;},/**
  365. * Get a canvas drawn the cropped image.
  366. * @param {Object} [options={}] - The config options.
  367. * @returns {HTMLCanvasElement} - The result canvas.
  368. */getCroppedCanvas:function getCroppedCanvas(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement){return null;}var canvasData=this.canvasData;var source=getSourceCanvas(this.image,this.imageData,canvasData,options);// Returns the source canvas if it is not cropped.
  369. if(!this.cropped){return source;}var _this$getData=this.getData(),initialX=_this$getData.x,initialY=_this$getData.y,initialWidth=_this$getData.width,initialHeight=_this$getData.height;var ratio=source.width/Math.floor(canvasData.naturalWidth);if(ratio!==1){initialX*=ratio;initialY*=ratio;initialWidth*=ratio;initialHeight*=ratio;}var aspectRatio=initialWidth/initialHeight;var maxSizes=getAdjustedSizes({aspectRatio:aspectRatio,width:options.maxWidth||Infinity,height:options.maxHeight||Infinity});var minSizes=getAdjustedSizes({aspectRatio:aspectRatio,width:options.minWidth||0,height:options.minHeight||0},'cover');var _getAdjustedSizes=getAdjustedSizes({aspectRatio:aspectRatio,width:options.width||(ratio!==1?source.width:initialWidth),height:options.height||(ratio!==1?source.height:initialHeight)}),width=_getAdjustedSizes.width,height=_getAdjustedSizes.height;width=Math.min(maxSizes.width,Math.max(minSizes.width,width));height=Math.min(maxSizes.height,Math.max(minSizes.height,height));var canvas=document.createElement('canvas');var context=canvas.getContext('2d');canvas.width=normalizeDecimalNumber(width);canvas.height=normalizeDecimalNumber(height);context.fillStyle=options.fillColor||'transparent';context.fillRect(0,0,width,height);var _options$imageSmoothi=options.imageSmoothingEnabled,imageSmoothingEnabled=_options$imageSmoothi===void 0?true:_options$imageSmoothi,imageSmoothingQuality=options.imageSmoothingQuality;context.imageSmoothingEnabled=imageSmoothingEnabled;if(imageSmoothingQuality){context.imageSmoothingQuality=imageSmoothingQuality;}// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
  370. var sourceWidth=source.width;var sourceHeight=source.height;// Source canvas parameters
  371. var srcX=initialX;var srcY=initialY;var srcWidth;var srcHeight;// Destination canvas parameters
  372. var dstX;var dstY;var dstWidth;var dstHeight;if(srcX<=-initialWidth||srcX>sourceWidth){srcX=0;srcWidth=0;dstX=0;dstWidth=0;}else if(srcX<=0){dstX=-srcX;srcX=0;srcWidth=Math.min(sourceWidth,initialWidth+srcX);dstWidth=srcWidth;}else if(srcX<=sourceWidth){dstX=0;srcWidth=Math.min(initialWidth,sourceWidth-srcX);dstWidth=srcWidth;}if(srcWidth<=0||srcY<=-initialHeight||srcY>sourceHeight){srcY=0;srcHeight=0;dstY=0;dstHeight=0;}else if(srcY<=0){dstY=-srcY;srcY=0;srcHeight=Math.min(sourceHeight,initialHeight+srcY);dstHeight=srcHeight;}else if(srcY<=sourceHeight){dstY=0;srcHeight=Math.min(initialHeight,sourceHeight-srcY);dstHeight=srcHeight;}var params=[srcX,srcY,srcWidth,srcHeight];// Avoid "IndexSizeError"
  373. if(dstWidth>0&&dstHeight>0){var scale=width/initialWidth;params.push(dstX*scale,dstY*scale,dstWidth*scale,dstHeight*scale);}// All the numerical parameters should be integer for `drawImage`
  374. // https://github.com/fengyuanchen/cropper/issues/476
  375. context.drawImage.apply(context,[source].concat(_toConsumableArray(params.map(function(param){return Math.floor(normalizeDecimalNumber(param));}))));return canvas;},/**
  376. * Change the aspect ratio of the crop box.
  377. * @param {number} aspectRatio - The new aspect ratio.
  378. * @returns {Cropper} this
  379. */setAspectRatio:function setAspectRatio(aspectRatio){var options=this.options;if(!this.disabled&&!isUndefined(aspectRatio)){// 0 -> NaN
  380. options.aspectRatio=Math.max(0,aspectRatio)||NaN;if(this.ready){this.initCropBox();if(this.cropped){this.renderCropBox();}}}return this;},/**
  381. * Change the drag mode.
  382. * @param {string} mode - The new drag mode.
  383. * @returns {Cropper} this
  384. */setDragMode:function setDragMode(mode){var options=this.options,dragBox=this.dragBox,face=this.face;if(this.ready&&!this.disabled){var croppable=mode===DRAG_MODE_CROP;var movable=options.movable&&mode===DRAG_MODE_MOVE;mode=croppable||movable?mode:DRAG_MODE_NONE;options.dragMode=mode;setData(dragBox,DATA_ACTION,mode);toggleClass(dragBox,CLASS_CROP,croppable);toggleClass(dragBox,CLASS_MOVE,movable);if(!options.cropBoxMovable){// Sync drag mode to crop box when it is not movable
  385. setData(face,DATA_ACTION,mode);toggleClass(face,CLASS_CROP,croppable);toggleClass(face,CLASS_MOVE,movable);}}return this;}};var AnotherCropper=WINDOW.Cropper;var Cropper$1=/*#__PURE__*/function(){/**
  386. * Create a new Cropper.
  387. * @param {Element} element - The target element for cropping.
  388. * @param {Object} [options={}] - The configuration options.
  389. */function Cropper(element){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Cropper);if(!element||!REGEXP_TAG_NAME.test(element.tagName)){throw new Error('The first argument is required and must be an <img> or <canvas> element.');}this.element=element;this.options=assign({},DEFAULTS,isPlainObject(options)&&options);this.cropped=false;this.disabled=false;this.pointers={};this.ready=false;this.reloading=false;this.replaced=false;this.sized=false;this.sizing=false;this.init();}_createClass(Cropper,[{key:"init",value:function init(){var element=this.element;var tagName=element.tagName.toLowerCase();var url;if(element[NAMESPACE]){return;}element[NAMESPACE]=this;if(tagName==='img'){this.isImg=true;// e.g.: "img/picture.jpg"
  390. url=element.getAttribute('src')||'';this.originalUrl=url;// Stop when it's a blank image
  391. if(!url){return;}// e.g.: "https://example.com/img/picture.jpg"
  392. url=element.src;}else if(tagName==='canvas'&&window.HTMLCanvasElement){url=element.toDataURL();}this.load(url);}},{key:"load",value:function load(url){var _this=this;if(!url){return;}this.url=url;this.imageData={};var element=this.element,options=this.options;if(!options.rotatable&&!options.scalable){options.checkOrientation=false;}// Only IE10+ supports Typed Arrays
  393. if(!options.checkOrientation||!window.ArrayBuffer){this.clone();return;}// Detect the mime type of the image directly if it is a Data URL
  394. if(REGEXP_DATA_URL.test(url)){// Read ArrayBuffer from Data URL of JPEG images directly for better performance
  395. if(REGEXP_DATA_URL_JPEG.test(url)){this.read(dataURLToArrayBuffer(url));}else{// Only a JPEG image may contains Exif Orientation information,
  396. // the rest types of Data URLs are not necessary to check orientation at all.
  397. this.clone();}return;}// 1. Detect the mime type of the image by a XMLHttpRequest.
  398. // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.
  399. var xhr=new XMLHttpRequest();var clone=this.clone.bind(this);this.reloading=true;this.xhr=xhr;// 1. Cross origin requests are only supported for protocol schemes:
  400. // http, https, data, chrome, chrome-extension.
  401. // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy
  402. // in some browsers as IE11 and Safari.
  403. xhr.onabort=clone;xhr.onerror=clone;xhr.ontimeout=clone;xhr.onprogress=function(){// Abort the request directly if it not a JPEG image for better performance
  404. if(xhr.getResponseHeader('content-type')!==MIME_TYPE_JPEG){xhr.abort();}};xhr.onload=function(){_this.read(xhr.response);};xhr.onloadend=function(){_this.reloading=false;_this.xhr=null;};// Bust cache when there is a "crossOrigin" property to avoid browser cache error
  405. if(options.checkCrossOrigin&&isCrossOriginURL(url)&&element.crossOrigin){url=addTimestamp(url);}// The third parameter is required for avoiding side-effect (#682)
  406. xhr.open('GET',url,true);xhr.responseType='arraybuffer';xhr.withCredentials=element.crossOrigin==='use-credentials';xhr.send();}},{key:"read",value:function read(arrayBuffer){var options=this.options,imageData=this.imageData;// Reset the orientation value to its default value 1
  407. // as some iOS browsers will render image with its orientation
  408. var orientation=resetAndGetOrientation(arrayBuffer);var rotate=0;var scaleX=1;var scaleY=1;if(orientation>1){// Generate a new URL which has the default orientation value
  409. this.url=arrayBufferToDataURL(arrayBuffer,MIME_TYPE_JPEG);var _parseOrientation=parseOrientation(orientation);rotate=_parseOrientation.rotate;scaleX=_parseOrientation.scaleX;scaleY=_parseOrientation.scaleY;}if(options.rotatable){imageData.rotate=rotate;}if(options.scalable){imageData.scaleX=scaleX;imageData.scaleY=scaleY;}this.clone();}},{key:"clone",value:function clone(){var element=this.element,url=this.url;var crossOrigin=element.crossOrigin;var crossOriginUrl=url;if(this.options.checkCrossOrigin&&isCrossOriginURL(url)){if(!crossOrigin){crossOrigin='anonymous';}// Bust cache when there is not a "crossOrigin" property (#519)
  410. crossOriginUrl=addTimestamp(url);}this.crossOrigin=crossOrigin;this.crossOriginUrl=crossOriginUrl;var image=document.createElement('img');if(crossOrigin){image.crossOrigin=crossOrigin;}image.src=crossOriginUrl||url;image.alt=element.alt||'The image to crop';this.image=image;image.onload=this.start.bind(this);image.onerror=this.stop.bind(this);addClass(image,CLASS_HIDE);element.parentNode.insertBefore(image,element.nextSibling);}},{key:"start",value:function start(){var _this2=this;var image=this.image;image.onload=null;image.onerror=null;this.sizing=true;// Match all browsers that use WebKit as the layout engine in iOS devices,
  411. // such as Safari for iOS, Chrome for iOS, and in-app browsers.
  412. var isIOSWebKit=WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent);var done=function done(naturalWidth,naturalHeight){assign(_this2.imageData,{naturalWidth:naturalWidth,naturalHeight:naturalHeight,aspectRatio:naturalWidth/naturalHeight});_this2.initialImageData=assign({},_this2.imageData);_this2.sizing=false;_this2.sized=true;_this2.build();};// Most modern browsers (excepts iOS WebKit)
  413. if(image.naturalWidth&&!isIOSWebKit){done(image.naturalWidth,image.naturalHeight);return;}var sizingImage=document.createElement('img');var body=document.body||document.documentElement;this.sizingImage=sizingImage;sizingImage.onload=function(){done(sizingImage.width,sizingImage.height);if(!isIOSWebKit){body.removeChild(sizingImage);}};sizingImage.src=image.src;// iOS WebKit will convert the image automatically
  414. // with its orientation once append it into DOM (#279)
  415. if(!isIOSWebKit){sizingImage.style.cssText='left:0;'+'max-height:none!important;'+'max-width:none!important;'+'min-height:0!important;'+'min-width:0!important;'+'opacity:0;'+'position:absolute;'+'top:0;'+'z-index:-1;';body.appendChild(sizingImage);}}},{key:"stop",value:function stop(){var image=this.image;image.onload=null;image.onerror=null;image.parentNode.removeChild(image);this.image=null;}},{key:"build",value:function build(){if(!this.sized||this.ready){return;}var element=this.element,options=this.options,image=this.image;// Create cropper elements
  416. var container=element.parentNode;var template=document.createElement('div');template.innerHTML=TEMPLATE;var cropper=template.querySelector(".".concat(NAMESPACE,"-container"));var canvas=cropper.querySelector(".".concat(NAMESPACE,"-canvas"));var dragBox=cropper.querySelector(".".concat(NAMESPACE,"-drag-box"));var cropBox=cropper.querySelector(".".concat(NAMESPACE,"-crop-box"));var face=cropBox.querySelector(".".concat(NAMESPACE,"-face"));this.container=container;this.cropper=cropper;this.canvas=canvas;this.dragBox=dragBox;this.cropBox=cropBox;this.viewBox=cropper.querySelector(".".concat(NAMESPACE,"-view-box"));this.face=face;canvas.appendChild(image);// Hide the original image
  417. addClass(element,CLASS_HIDDEN);// Inserts the cropper after to the current image
  418. container.insertBefore(cropper,element.nextSibling);// Show the image if is hidden
  419. if(!this.isImg){removeClass(image,CLASS_HIDE);}this.initPreview();this.bind();options.initialAspectRatio=Math.max(0,options.initialAspectRatio)||NaN;options.aspectRatio=Math.max(0,options.aspectRatio)||NaN;options.viewMode=Math.max(0,Math.min(3,Math.round(options.viewMode)))||0;addClass(cropBox,CLASS_HIDDEN);if(!options.guides){addClass(cropBox.getElementsByClassName("".concat(NAMESPACE,"-dashed")),CLASS_HIDDEN);}if(!options.center){addClass(cropBox.getElementsByClassName("".concat(NAMESPACE,"-center")),CLASS_HIDDEN);}if(options.background){addClass(cropper,"".concat(NAMESPACE,"-bg"));}if(!options.highlight){addClass(face,CLASS_INVISIBLE);}if(options.cropBoxMovable){addClass(face,CLASS_MOVE);setData(face,DATA_ACTION,ACTION_ALL);}if(!options.cropBoxResizable){addClass(cropBox.getElementsByClassName("".concat(NAMESPACE,"-line")),CLASS_HIDDEN);addClass(cropBox.getElementsByClassName("".concat(NAMESPACE,"-point")),CLASS_HIDDEN);}this.render();this.ready=true;this.setDragMode(options.dragMode);if(options.autoCrop){this.crop();}this.setData(options.data);if(isFunction(options.ready)){addListener(element,EVENT_READY,options.ready,{once:true});}dispatchEvent(element,EVENT_READY);}},{key:"unbuild",value:function unbuild(){if(!this.ready){return;}this.ready=false;this.unbind();this.resetPreview();this.cropper.parentNode.removeChild(this.cropper);removeClass(this.element,CLASS_HIDDEN);}},{key:"uncreate",value:function uncreate(){if(this.ready){this.unbuild();this.ready=false;this.cropped=false;}else if(this.sizing){this.sizingImage.onload=null;this.sizing=false;this.sized=false;}else if(this.reloading){this.xhr.onabort=null;this.xhr.abort();}else if(this.image){this.stop();}}/**
  420. * Get the no conflict cropper class.
  421. * @returns {Cropper} The cropper class.
  422. */}],[{key:"noConflict",value:function noConflict(){window.Cropper=AnotherCropper;return Cropper;}/**
  423. * Change the default options.
  424. * @param {Object} options - The new default options.
  425. */},{key:"setDefaults",value:function setDefaults(options){assign(DEFAULTS,isPlainObject(options)&&options);}}]);return Cropper;}();assign(Cropper$1.prototype,render,preview,events,handlers,change,methods);var cropper='';var cosJsSdkV5={exports:{}};(function(module,exports){(function webpackUniversalModuleDefinition(root,factory){module.exports=factory();})(commonjsGlobal,function(){return(/******/function(modules){// webpackBootstrap
  426. /******/ // The module cache
  427. /******/var installedModules={};/******/ /******/ // The require function
  428. /******/function __webpack_require__(moduleId){/******/ /******/ // Check if module is in cache
  429. /******/if(installedModules[moduleId]){/******/return installedModules[moduleId].exports;/******/}/******/ // Create a new module (and put it into the cache)
  430. /******/var module=installedModules[moduleId]={/******/i:moduleId,/******/l:false,/******/exports:{}/******/};/******/ /******/ // Execute the module function
  431. /******/modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);/******/ /******/ // Flag the module as loaded
  432. /******/module.l=true;/******/ /******/ // Return the exports of the module
  433. /******/return module.exports;/******/}/******/ /******/ /******/ // expose the modules object (__webpack_modules__)
  434. /******/__webpack_require__.m=modules;/******/ /******/ // expose the module cache
  435. /******/__webpack_require__.c=installedModules;/******/ /******/ // define getter function for harmony exports
  436. /******/__webpack_require__.d=function(exports,name,getter){/******/if(!__webpack_require__.o(exports,name)){/******/Object.defineProperty(exports,name,{enumerable:true,get:getter});/******/}/******/};/******/ /******/ // define __esModule on exports
  437. /******/__webpack_require__.r=function(exports){/******/if(typeof Symbol!=='undefined'&&Symbol.toStringTag){/******/Object.defineProperty(exports,Symbol.toStringTag,{value:'Module'});/******/}/******/Object.defineProperty(exports,'__esModule',{value:true});/******/};/******/ /******/ // create a fake namespace object
  438. /******/ // mode & 1: value is a module id, require it
  439. /******/ // mode & 2: merge all properties of value into the ns
  440. /******/ // mode & 4: return value when already ns object
  441. /******/ // mode & 8|1: behave like require
  442. /******/__webpack_require__.t=function(value,mode){/******/if(mode&1)value=__webpack_require__(value);/******/if(mode&8)return value;/******/if(mode&4&&_typeof2(value)==='object'&&value&&value.__esModule)return value;/******/var ns=Object.create(null);/******/__webpack_require__.r(ns);/******/Object.defineProperty(ns,'default',{enumerable:true,value:value});/******/if(mode&2&&typeof value!='string')for(var key in value){__webpack_require__.d(ns,key,function(key){return value[key];}.bind(null,key));}/******/return ns;/******/};/******/ /******/ // getDefaultExport function for compatibility with non-harmony modules
  443. /******/__webpack_require__.n=function(module){/******/var getter=module&&module.__esModule?/******/function getDefault(){return module['default'];}:/******/function getModuleExports(){return module;};/******/__webpack_require__.d(getter,'a',getter);/******/return getter;/******/};/******/ /******/ // Object.prototype.hasOwnProperty.call
  444. /******/__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property);};/******/ /******/ // __webpack_public_path__
  445. /******/__webpack_require__.p="/dist/";/******/ /******/ /******/ // Load entry module and return exports
  446. /******/return __webpack_require__(__webpack_require__.s="./index.js");/******/}/************************************************************************/ /******/({/***/"./index.js":/*!******************!*\
  447. !*** ./index.js ***!
  448. \******************/ /*! no static exports found */ /***/function indexJs(module,exports,__webpack_require__){var COS=__webpack_require__(/*! ./src/cos */"./src/cos.js");module.exports=COS;/***/},/***/"./lib/base64.js":/*!***********************!*\
  449. !*** ./lib/base64.js ***!
  450. \***********************/ /*! no static exports found */ /***/function libBase64Js(module,exports){/*
  451. * $Id: base64.js,v 2.15 2014/04/05 12:58:57 dankogai Exp dankogai $
  452. *
  453. * Licensed under the BSD 3-Clause License.
  454. * http://opensource.org/licenses/BSD-3-Clause
  455. *
  456. * References:
  457. * http://en.wikipedia.org/wiki/Base64
  458. */var Base64=function(global){global=global||{};// existing version for noConflict()
  459. var _Base64=global.Base64;var version="2.1.9";// constants
  460. var b64chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';var b64tab=function(bin){var t={};for(var i=0,l=bin.length;i<l;i++){t[bin.charAt(i)]=i;}return t;}(b64chars);var fromCharCode=String.fromCharCode;// encoder stuff
  461. var cb_utob=function cb_utob(c){if(c.length<2){var cc=c.charCodeAt(0);return cc<0x80?c:cc<0x800?fromCharCode(0xc0|cc>>>6)+fromCharCode(0x80|cc&0x3f):fromCharCode(0xe0|cc>>>12&0x0f)+fromCharCode(0x80|cc>>>6&0x3f)+fromCharCode(0x80|cc&0x3f);}else{var cc=0x10000+(c.charCodeAt(0)-0xD800)*0x400+(c.charCodeAt(1)-0xDC00);return fromCharCode(0xf0|cc>>>18&0x07)+fromCharCode(0x80|cc>>>12&0x3f)+fromCharCode(0x80|cc>>>6&0x3f)+fromCharCode(0x80|cc&0x3f);}};var re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;var utob=function utob(u){return u.replace(re_utob,cb_utob);};var cb_encode=function cb_encode(ccc){var padlen=[0,2,1][ccc.length%3],ord=ccc.charCodeAt(0)<<16|(ccc.length>1?ccc.charCodeAt(1):0)<<8|(ccc.length>2?ccc.charCodeAt(2):0),chars=[b64chars.charAt(ord>>>18),b64chars.charAt(ord>>>12&63),padlen>=2?'=':b64chars.charAt(ord>>>6&63),padlen>=1?'=':b64chars.charAt(ord&63)];return chars.join('');};var btoa=global.btoa?function(b){return global.btoa(b);}:function(b){return b.replace(/[\s\S]{1,3}/g,cb_encode);};var _encode=function _encode(u){return btoa(utob(u));};var encode=function encode(u,urisafe){return!urisafe?_encode(String(u)):_encode(String(u)).replace(/[+\/]/g,function(m0){return m0=='+'?'-':'_';}).replace(/=/g,'');};var encodeURI=function encodeURI(u){return encode(u,true);};// decoder stuff
  462. var re_btou=new RegExp(['[\xC0-\xDF][\x80-\xBF]','[\xE0-\xEF][\x80-\xBF]{2}','[\xF0-\xF7][\x80-\xBF]{3}'].join('|'),'g');var cb_btou=function cb_btou(cccc){switch(cccc.length){case 4:var cp=(0x07&cccc.charCodeAt(0))<<18|(0x3f&cccc.charCodeAt(1))<<12|(0x3f&cccc.charCodeAt(2))<<6|0x3f&cccc.charCodeAt(3),offset=cp-0x10000;return fromCharCode((offset>>>10)+0xD800)+fromCharCode((offset&0x3FF)+0xDC00);case 3:return fromCharCode((0x0f&cccc.charCodeAt(0))<<12|(0x3f&cccc.charCodeAt(1))<<6|0x3f&cccc.charCodeAt(2));default:return fromCharCode((0x1f&cccc.charCodeAt(0))<<6|0x3f&cccc.charCodeAt(1));}};var btou=function btou(b){return b.replace(re_btou,cb_btou);};var cb_decode=function cb_decode(cccc){var len=cccc.length,padlen=len%4,n=(len>0?b64tab[cccc.charAt(0)]<<18:0)|(len>1?b64tab[cccc.charAt(1)]<<12:0)|(len>2?b64tab[cccc.charAt(2)]<<6:0)|(len>3?b64tab[cccc.charAt(3)]:0),chars=[fromCharCode(n>>>16),fromCharCode(n>>>8&0xff),fromCharCode(n&0xff)];chars.length-=[0,0,2,1][padlen];return chars.join('');};var atob=global.atob?function(a){return global.atob(a);}:function(a){return a.replace(/[\s\S]{1,4}/g,cb_decode);};var _decode=function _decode(a){return btou(atob(a));};var decode=function decode(a){return _decode(String(a).replace(/[-_]/g,function(m0){return m0=='-'?'+':'/';}).replace(/[^A-Za-z0-9\+\/]/g,''));};var noConflict=function noConflict(){var Base64=global.Base64;global.Base64=_Base64;return Base64;};// export Base64
  463. var Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict};return Base64;}();module.exports=Base64;/***/},/***/"./lib/beacon.min.js":/*!***************************!*\
  464. !*** ./lib/beacon.min.js ***!
  465. \***************************/ /*! no static exports found */ /***/function libBeaconMinJs(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__;var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");!function(t,e){"object"==_typeof(exports)&&"undefined"!=typeof module?module.exports=e():!(__WEBPACK_AMD_DEFINE_FACTORY__=e,__WEBPACK_AMD_DEFINE_RESULT__=typeof __WEBPACK_AMD_DEFINE_FACTORY__==='function'?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__!==undefined&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__));}(this,function(){var _t=function t(e,n){return _t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var n in e){Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);}},_t(e,n);};var _e=function e(){return _e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){for(var o in e=arguments[n]){Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);}}return t;},_e.apply(this,arguments);};function n(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{u(r.next(t));}catch(t){i(t);}}function a(t){try{u(r.throw(t));}catch(t){i(t);}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e);})).then(s,a);}u((r=r.apply(t,e||[])).next());});}function r(t,e){var n,r,o,i,s={label:0,sent:function sent(){if(1&o[0])throw o[1];return o[1];},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this;}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;){try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue;}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break;}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break;}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break;}o[2]&&s.ops.pop(),s.trys.pop();continue;}i=e.call(t,s);}catch(t){i=[6,t],r=0;}finally{n=o=0;}}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0};}([i,a]);};}}var o="__BEACON_",i="__BEACON_deviceId",s="last_report_time",a="sending_event_ids",u="beacon_config",c="beacon_config_request_time",l=function(){function t(){var t=this;this.emit=function(e,n){if(t){var r,o=t.__EventsList[e];if(null==o?void 0:o.length){o=o.slice();for(var i=0;i<o.length;i++){r=o[i];try{var s=r.callback.apply(t,[n]);if(1===r.type&&t.remove(e,r.callback),!1===s)break;}catch(t){throw t;}}}return t;}},this.__EventsList={};}return t.prototype.indexOf=function(t,e){for(var n=0;n<t.length;n++){if(t[n].callback===e)return n;}return-1;},t.prototype.on=function(t,e,n){if(void 0===n&&(n=0),this){var r=this.__EventsList[t];if(r||(r=this.__EventsList[t]=[]),-1===this.indexOf(r,e)){var o={name:t,type:n||0,callback:e};return r.push(o),this;}return this;}},t.prototype.one=function(t,e){this.on(t,e,1);},t.prototype.remove=function(t,e){if(this){var n=this.__EventsList[t];if(!n)return null;if(!e){try{delete this.__EventsList[t];}catch(t){}return null;}if(n.length){var r=this.indexOf(n,e);n.splice(r,1);}return this;}},t;}();function p(t,e){for(var n={},r=0,o=Object.keys(t);r<o.length;r++){var i=o[r],s=t[i];if("string"==typeof s)n[h(i)]=h(s);else{if(e)throw new Error("value mast be string !!!!");n[h(String(i))]=h(String(s));}}return n;}function h(t){if("string"!=typeof t)return t;try{return t.replace(new RegExp("\\|","g"),"%7C").replace(new RegExp("\\&","g"),"%26").replace(new RegExp("\\=","g"),"%3D").replace(new RegExp("\\+","g"),"%2B");}catch(t){return"";}}function f(t){return String(t.A99)+String(t.A100);}var d=function d(){};var v=function(){function t(t){var n=this;this.lifeCycle=new l(),this.uploadJobQueue=[],this.additionalParams={},this.delayTime=0,this._normalLogPipeline=function(t){if(!t||!t.reduce||!t.length)throw new TypeError("createPipeline 方法需要传入至少有一个 pipe 的数组");return 1===t.length?function(e,n){t[0](e,n||d);}:t.reduce(function(t,e){return function(n,r){return void 0===r&&(r=d),t(n,function(t){return null==e?void 0:e(t,r);});};});}([function(t){n.send({url:n.strategy.getUploadUrl(),data:t,method:"post",contentType:"application/json;charset=UTF-8"},function(){var e=n.config.onReportSuccess;"function"==typeof e&&e(JSON.stringify(t.events));},function(){var e=n.config.onReportFail;"function"==typeof e&&e(JSON.stringify(t.events));});}]),function(t,e){if(!t)throw e instanceof Error?e:new Error(e);}(Boolean(t.appkey),"appkey must be initial"),this.config=_e({},t);}return t.prototype.onUserAction=function(t,e){this.preReport(t,e,!1);},t.prototype.onDirectUserAction=function(t,e){this.preReport(t,e,!0);},t.prototype.preReport=function(t,e,n){t?this.strategy.isEventUpOnOff()&&(this.strategy.isBlackEvent(t)||this.strategy.isSampleEvent(t)||this.onReport(t,e,n)):this.errorReport.reportError("602"," no eventCode");},t.prototype.addAdditionalParams=function(t){for(var e=0,n=Object.keys(t);e<n.length;e++){var r=n[e];this.additionalParams[r]=t[r];}},t.prototype.setChannelId=function(t){this.commonInfo.channelID=String(t);},t.prototype.setOpenId=function(t){this.commonInfo.openid=String(t);},t.prototype.setUnionid=function(t){this.commonInfo.unid=String(t);},t.prototype.getDeviceId=function(){return this.commonInfo.deviceId;},t.prototype.getCommonInfo=function(){return this.commonInfo;},t.prototype.removeSendingId=function(t){try{var e=JSON.parse(this.storage.getItem(a)),n=e.indexOf(t);-1!=n&&(e.splice(n,1),this.storage.setItem(a,JSON.stringify(e)));}catch(t){}},t;}(),g=function(){function t(t,e,n,r){this.requestParams={},this.network=r,this.requestParams.attaid="00400014144",this.requestParams.token="6478159937",this.requestParams.product_id=t.appkey,this.requestParams.platform=n,this.requestParams.uin=e.deviceId,this.requestParams.model="",this.requestParams.os=n,this.requestParams.app_version=t.appVersion,this.requestParams.sdk_version=e.sdkVersion,this.requestParams.error_stack="",this.uploadUrl=t.isOversea?"https://htrace.wetvinfo.com/kv":"https://h.trace.qq.com/kv";}return t.prototype.reportError=function(t,e){this.requestParams._dc=Math.random(),this.requestParams.error_msg=e,this.requestParams.error_code=t,this.network.get(this.uploadUrl,{params:this.requestParams}).catch(function(t){});},t;}(),y=function(){function t(t,e,n,r,o){this.strategy={isEventUpOnOff:!0,httpsUploadUrl:"https://otheve.beacon.qq.com/analytics/v2_upload",requestInterval:30,blacklist:[],samplelist:[]},this.realSample={},this.appkey="",this.needQueryConfig=!0,this.appkey=e.appkey,this.storage=r,this.needQueryConfig=t;try{var i=JSON.parse(this.storage.getItem(u));i&&this.processData(i);}catch(t){}e.isOversea&&(this.strategy.httpsUploadUrl="https://svibeacon.onezapp.com/analytics/v2_upload"),!e.isOversea&&this.needRequestConfig()&&this.requestConfig(e.appVersion,n,o);}return t.prototype.requestConfig=function(t,e,n){var r=this;this.storage.setItem(c,Date.now().toString()),n.post("https://oth.str.beacon.qq.com/trpc.beacon.configserver.BeaconConfigService/QueryConfig",{platformId:"undefined"==typeof wx?"3":"4",mainAppKey:this.appkey,appVersion:t,sdkVersion:e.sdkVersion,osVersion:e.userAgent,model:"",packageName:"",params:{A3:e.deviceId}}).then(function(t){if(0==t.data.ret)try{var e=JSON.parse(t.data.beaconConfig);e&&(r.processData(e),r.storage.setItem(u,t.data.beaconConfig));}catch(t){}else r.processData(null),r.storage.setItem(u,"");}).catch(function(t){});},t.prototype.processData=function(t){var e,n,r,o,i;this.strategy.isEventUpOnOff=null!==(e=null==t?void 0:t.isEventUpOnOff)&&void 0!==e?e:this.strategy.isEventUpOnOff,this.strategy.httpsUploadUrl=null!==(n=null==t?void 0:t.httpsUploadUrl)&&void 0!==n?n:this.strategy.httpsUploadUrl,this.strategy.requestInterval=null!==(r=null==t?void 0:t.requestInterval)&&void 0!==r?r:this.strategy.requestInterval,this.strategy.blacklist=null!==(o=null==t?void 0:t.blacklist)&&void 0!==o?o:this.strategy.blacklist,this.strategy.samplelist=null!==(i=null==t?void 0:t.samplelist)&&void 0!==i?i:this.strategy.samplelist;for(var s=0,a=this.strategy.samplelist;s<a.length;s++){var u=a[s].split(",");2==u.length&&(this.realSample[u[0]]=u[1]);}},t.prototype.needRequestConfig=function(){if(!this.needQueryConfig)return!1;var t=Number(this.storage.getItem(c));return Date.now()-t>60*this.strategy.requestInterval*1e3;},t.prototype.getUploadUrl=function(){return this.strategy.httpsUploadUrl+"?appkey="+this.appkey;},t.prototype.isBlackEvent=function(t){return-1!=this.strategy.blacklist.indexOf(t);},t.prototype.isEventUpOnOff=function(){return this.strategy.isEventUpOnOff;},t.prototype.isSampleEvent=function(t){return!!Object.prototype.hasOwnProperty.call(this.realSample,t)&&this.realSample[t]<Math.floor(Math.random()*Math.floor(1e4));},t;}(),m="session_storage_key",w=function(){function t(t,e,n){this.getSessionStackDepth=0,this.beacon=n,this.storage=t,this.duration=e,this.appkey=n.config.appkey;}return t.prototype.getSession=function(){this.getSessionStackDepth+=1;var t=this.storage.getItem(m);if(!t)return this.createSession();var e="",n=0;try{var r=JSON.parse(t)||{sessionId:void 0,sessionStart:void 0};if(!r.sessionId||!r.sessionStart)return this.createSession();var o=Number(this.storage.getItem(s));if(Date.now()-o>this.duration)return this.createSession();e=r.sessionId,n=r.sessionStart,this.getSessionStackDepth=0;}catch(t){}return{sessionId:e,sessionStart:n};},t.prototype.createSession=function(){var t=Date.now(),e={sessionId:this.appkey+"_"+t.toString(),sessionStart:t};this.storage.setItem(m,JSON.stringify(e)),this.storage.setItem(s,t.toString());var n="is_new_user",r=this.storage.getItem(n);return this.getSessionStackDepth<=1&&this.beacon.onDirectUserAction("rqd_applaunched",{A21:r?"N":"Y"}),this.storage.setItem(n,JSON.stringify(!1)),e;},t;}();function b(){var t=navigator.userAgent,e=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1,n=t.indexOf("Edge")>-1&&!e,r=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1;if(e){new RegExp("MSIE (\\d+\\.\\d+);").test(t);var o=parseFloat(RegExp.$1);return 7==o?7:8==o?8:9==o?9:10==o?10:6;}return n?-2:r?11:-1;}function S(t,e){var n,r;return(n="https://tun-cos-1258344701.file.myqcloud.com/fp.js",void 0===r&&(r=Date.now()+"-"+Math.random()),new Promise(function(t,e){if(document.getElementById(r))t(void 0);else{var o=document.getElementsByTagName("head")[0],i=document.createElement("script");i.onload=function(){return function(){i.onload=null,t(void 0);};},i.onerror=function(t){i.onerror=null,o.removeChild(i),e(t);},i.src=n,i.id=r,o.appendChild(i);}})).then(function(){new Fingerprint().getQimei36(t,e);}).catch(function(t){}),"";}var _I=function I(){return(_I=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){for(var o in e=arguments[n]){Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);}}return t;}).apply(this,arguments);};var E,k=function(){function t(t,e){void 0===e&&(e={}),this.reportOptions={},this.config=t,this.reportOptions=e;}return t.canUseDB=function(){return!!(null===window||void 0===window?void 0:window.indexedDB);},t.prototype.openDB=function(){var e=this;return new Promise(function(n,r){if(!t.canUseDB())return r({message:"当前不支持 indexeddb"});var o=e.config,i=o.name,s=o.version,a=o.stores,u=indexedDB.open(i,s);u.onsuccess=function(){e.db=u.result,n(),_I({result:1,func:"open",params:JSON.stringify(e.config)},e.reportOptions);},u.onerror=function(t){var n,o;r(t),_I({result:0,func:"open",params:JSON.stringify(e.config),error_msg:null===(o=null===(n=t.target)||void 0===n?void 0:n.error)||void 0===o?void 0:o.message},e.reportOptions);},u.onupgradeneeded=function(){e.db=u.result;try{null==a||a.forEach(function(t){e.createStore(t);});}catch(t){_I({result:0,func:"open",params:JSON.stringify(e.config),error_msg:t.message},e.reportOptions),r(t);}};});},t.prototype.useStore=function(t){return this.storeName=t,this;},t.prototype.deleteDB=function(){var t=this;return this.closeDB(),new Promise(function(e,n){var r=indexedDB.deleteDatabase(t.config.name);r.onsuccess=function(){return e();},r.onerror=n;});},t.prototype.closeDB=function(){var t;null===(t=this.db)||void 0===t||t.close(),this.db=null;},t.prototype.getStoreCount=function(){var t=this;return new Promise(function(e,n){var r=t.getStore("readonly").count();r.onsuccess=function(){return e(r.result);},r.onerror=n;});},t.prototype.clearStore=function(){var t=this;return new Promise(function(e,n){var r=t.getStore("readwrite").clear();r.onsuccess=function(){return e();},r.onerror=n;});},t.prototype.add=function(t,e){var n=this;return new Promise(function(r,o){var i=n.getStore("readwrite").add(t,e);i.onsuccess=function(){r(i.result);},i.onerror=o;});},t.prototype.put=function(t,e){var n=this;return new Promise(function(r,o){var i=n.getStore("readwrite").put(t,e);i.onsuccess=function(){r(i.result);},i.onerror=o;});},t.prototype.getStoreAllData=function(){var t=this;return new Promise(function(e,n){var r=t.getStore("readonly").openCursor(),o=[];r.onsuccess=function(){var t;if(null===(t=r.result)||void 0===t?void 0:t.value){var n=r.result.value;o.push(n),r.result.continue();}else e(o);},r.onerror=n;});},t.prototype.getDataRangeByIndex=function(t,e,n,r,o){var i=this;return new Promise(function(s,a){var u=i.getStore().index(t),c=IDBKeyRange.bound(e,n,r,o),l=[],p=u.openCursor(c);p.onsuccess=function(){var t;(null===(t=null==p?void 0:p.result)||void 0===t?void 0:t.value)?(l.push(null==p?void 0:p.result.value),null==p||p.result.continue()):s(l);},p.onerror=a;});},t.prototype.removeDataByIndex=function(t,e,n,r,o){var i=this;return new Promise(function(s,a){var u=i.getStore("readwrite").index(t),c=IDBKeyRange.bound(e,n,r,o),l=u.openCursor(c),p=0;l.onsuccess=function(t){var e=t.target.result;e?(p+=1,e.delete(),e.continue()):s(p);},l.onerror=a;});},t.prototype.createStore=function(t){var e=t.name,n=t.indexes,r=void 0===n?[]:n,o=t.options;if(this.db){this.db.objectStoreNames.contains(e)&&this.db.deleteObjectStore(e);var i=this.db.createObjectStore(e,o);r.forEach(function(t){i.createIndex(t.indexName,t.keyPath,t.options);});}},t.prototype.getStore=function(t){var e;return void 0===t&&(t="readonly"),null===(e=this.db)||void 0===e?void 0:e.transaction(this.storeName,t).objectStore(this.storeName);},t;}(),O="event_table_v3",C="eventId",D=function(){function t(t){this.isReady=!1,this.taskQueue=Promise.resolve(),this.db=new k({name:"Beacon_"+t+"_V3",version:1,stores:[{name:O,options:{keyPath:C},indexes:[{indexName:C,keyPath:C,options:{unique:!0}}]}]}),this.open();}return t.prototype.getCount=function(){var t=this;return this.readyExec(function(){return t.db.getStoreCount();});},t.prototype.setItem=function(t,e){var n=this;return this.readyExec(function(){return n.db.add({eventId:t,value:e});});},t.prototype.getItem=function(t){return n(this,void 0,void 0,function(){var e=this;return r(this,function(n){return[2,this.readyExec(function(){return e.db.getDataRangeByIndex(C,t,t);})];});});},t.prototype.removeItem=function(t){var e=this;return this.readyExec(function(){return e.db.removeDataByIndex(C,t,t);});},t.prototype.updateItem=function(t,e){var n=this;return this.readyExec(function(){return n.db.put({eventId:t,value:e});});},t.prototype.iterate=function(t){var e=this;return this.readyExec(function(){return e.db.getStoreAllData().then(function(e){e.forEach(function(e){t(e.value);});});});},t.prototype.open=function(){return n(this,void 0,void 0,function(){var t=this;return r(this,function(e){switch(e.label){case 0:return this.taskQueue=this.taskQueue.then(function(){return t.db.openDB();}),[4,this.taskQueue];case 1:return e.sent(),this.isReady=!0,this.db.useStore(O),[2];}});});},t.prototype.readyExec=function(t){return this.isReady?t():(this.taskQueue=this.taskQueue.then(function(){return t();}),this.taskQueue);},t;}(),x=function(){function t(t){this.keyObject={},this.storage=t;}return t.prototype.getCount=function(){return this.storage.getStoreCount();},t.prototype.removeItem=function(t){this.storage.removeItem(t),delete this.keyObject[t];},t.prototype.setItem=function(t,e){var n=JSON.stringify(e);this.storage.setItem(t,n),this.keyObject[t]=e;},t.prototype.iterate=function(t){for(var e=Object.keys(this.keyObject),n=0;n<e.length;n++){var r=this.storage.getItem(e[n]);t(JSON.parse(r));}},t;}(),_=function(){function t(t,e){var n=this;this.dbEventCount=0,b()>0||!window.indexedDB||/X5Lite/.test(navigator.userAgent)?(this.store=new x(e),this.dbEventCount=this.store.getCount()):(this.store=new D(t),this.getCount().then(function(t){n.dbEventCount=t;}).catch(function(t){}));}return t.prototype.getCount=function(){return n(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.store.getCount()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,Promise.reject()];case 3:return[2];}});});},t.prototype.insertEvent=function(t,e){return n(this,void 0,void 0,function(){var n,o;return r(this,function(r){switch(r.label){case 0:if(this.dbEventCount>=1e4)return[2,Promise.reject()];n=f(t.mapValue),r.label=1;case 1:return r.trys.push([1,3,,4]),this.dbEventCount++,[4,this.store.setItem(n,t)];case 2:return[2,r.sent()];case 3:return o=r.sent(),e&&e(o,t),this.dbEventCount--,[2,Promise.reject()];case 4:return[2];}});});},t.prototype.getEvents=function(){return n(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:t=[],e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.store.iterate(function(e){t.push(e);})];case 2:return e.sent(),[2,Promise.all(t)];case 3:return e.sent(),[2,Promise.all(t)];case 4:return[2];}});});},t.prototype.removeEvent=function(t){return n(this,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:e=f(t.mapValue),n.label=1;case 1:return n.trys.push([1,3,,4]),this.dbEventCount--,[4,this.store.removeItem(e)];case 2:return[2,n.sent()];case 3:return n.sent(),this.dbEventCount++,[2,Promise.reject()];case 4:return[2];}});});},t;}(),_P=function P(){return(_P=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){for(var o in e=arguments[n]){Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);}}return t;}).apply(this,arguments);};function T(t){try{return decodeURIComponent(t.replace(/\+/g," "));}catch(t){return null;}}function U(t,e){var n=[null,void 0,"",NaN].includes(t);if(e.isSkipEmpty&&n)return null;var r=!e.isSkipEmpty&&n?"":t;try{return e.encode?encodeURIComponent(r):r;}catch(t){return null;}}function N(t,e){void 0===e&&(e={encode:!0,isSkipEmpty:!1});var n=t.url,r=t.query,o=void 0===r?{}:r,i=t.hash,s=n.split("#"),a=s[0],u=s[1],c=void 0===u?"":u,l=a.split("?")[0],p=[],h=U(i||c,e),f=_P(_P({},function(t){var e=t.split("#"),n=e[0],r=e[1],o=void 0===r?"":r,i=n.split("?"),s=i[0],a=i[1],u=void 0===a?"":a,c=T(o),l=Object.create(null);return u.split("&").forEach(function(t){var e=t.split("="),n=e[0],r=e[1],o=void 0===r?"":r,i=T(n),s=T(o);null===i||null===s||""===i&&""===s||l[i]||(l[i]=s);}),{url:s,query:l,hash:c};}(n).query),o);return Object.keys(f).forEach(function(t){var n=U(t,e),r=U(f[t],e);null!==n&&null!==r&&p.push(n+"="+r);}),l+(p.length?"?"+p.join("&"):"")+(h?"#"+h:"");}function j(t,e){return new Promise(function(n,r){if(e&&document.querySelectorAll("script[data-tag="+e+"]").length)return n();var o=document.createElement("script"),i=_P({type:"text/javascript",charset:"utf-8"},t);Object.keys(i).forEach(function(t){return function(t,e,n){if(t)return void 0===n?t.getAttribute(e):t.setAttribute(e,n);}(o,t,i[t]);}),e&&(o.dataset.tag=e),o.onload=function(){return n();},o.onreadystatechange=function(){var t=o.readyState;["complete","loaded"].includes(t)&&(o.onreadystatechange=null,n());},o.onerror=r,document.body.appendChild(o);});}!function(t){t[t.equal=0]="equal",t[t.low=-1]="low",t[t.high=1]="high";}(E||(E={}));var _q=function q(){return(_q=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){for(var o in e=arguments[n]){Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);}}return t;}).apply(this,arguments);};function A(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{u(r.next(t));}catch(t){i(t);}}function a(t){try{u(r.throw(t));}catch(t){i(t);}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e);})).then(s,a);}u((r=r.apply(t,e||[])).next());});}function R(t,e){var n,r,o,i,s={label:0,sent:function sent(){if(1&o[0])throw o[1];return o[1];},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this;}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;){try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue;}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break;}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break;}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break;}o[2]&&s.ops.pop(),s.trys.pop();continue;}i=e.call(t,s);}catch(t){i=[6,t],r=0;}finally{n=o=0;}}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0};}([i,a]);};}}var B=function(){function t(){this.interceptors=[];}return t.prototype.use=function(t,e){return this.interceptors.push({resolved:t,rejected:e}),this.interceptors.length-1;},t.prototype.traverse=function(t,e){void 0===e&&(e=!1);var n=Promise.resolve(t);return(e?Array.prototype.reduceRight:Array.prototype.reduce).call(this.interceptors,function(t,e){if(e){var r=e.resolved,o=e.rejected;n=n.then(r,o);}return t;},""),n;},t.prototype.eject=function(t){this.interceptors[t]&&(this.interceptors[t]=null);},t;}(),J={defaults:{timeout:0,method:"GET",mode:"cors",redirect:"follow",credentials:"same-origin"},headers:{common:{Accept:"application/json, text/plain, */*"},POST:{"Content-Type":"application/x-www-form-urlencoded"},PUT:{"Content-Type":"application/x-www-form-urlencoded"},PATCH:{"Content-Type":"application/x-www-form-urlencoded"}},baseURL:"",polyfillUrl:"https://vm.gtimg.cn/comps/script/fetch.min.js",interceptors:{request:new B(),response:new B()}},V=/^([a-z][a-z\d+\-.]*:)?\/\//i,Q=Object.prototype.toString;function L(t){return A(this,void 0,void 0,function(){var e;return R(this,function(n){switch(n.label){case 0:if(window.fetch)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,j({src:t})];case 2:return n.sent(),[3,4];case 3:throw e=n.sent(),new Error("加载 polyfill "+t+" 失败: "+e.message);case 4:return[2];}});});}function M(t){return["Accept","Content-Type"].forEach(function(e){return n=e,void((r=t.headers)&&Object.keys(r).forEach(function(t){t!==n&&t.toUpperCase()===n.toUpperCase()&&(r[n]=r[t],delete r[t]);}));var n,r;}),function(t){if("[object Object]"!==Q.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype;}(t.body)&&(t.body=JSON.stringify(t.body),t.headers&&(t.headers["Content-Type"]="application/json;charset=utf-8")),t;}function K(t){return A(this,void 0,void 0,function(){var e,n,r,o,i,s,a,u,c,l,p,h,f,d,v,g,y;return R(this,function(m){switch(m.label){case 0:return e=J.baseURL,n=J.defaults,r=J.interceptors,[4,L(J.polyfillUrl)];case 1:return m.sent(),(o=_q(_q({},n),t)).headers||(o.headers=function(t){void 0===t&&(t="GET");var e=J.headers[t]||{};return _q(_q({},J.headers.common),e);}(o.method)),M(o),[4,r.request.traverse(o,!0)];case 2:if((i=m.sent())instanceof Error)throw i;return i.url=function(t,e){return!t||V.test(e)?e:t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"");}(e,i.url),s=i.url,a=i.timeout,u=i.params,c=i.method,l=["GET","DELETE","OPTIONS","HEAD"].includes(void 0===c?"GET":c)&&!!u,p=l?N({url:s,query:u}):s,h=[],a&&!i.signal&&(v=new Promise(function(t){f=setTimeout(function(){t(new Error("timeout"));},a);}),h.push(v),d=new AbortController(),i.signal=d.signal),h.push(fetch(p,i).catch(function(t){return t;})),[4,Promise.race(h)];case 3:return g=m.sent(),f&&clearTimeout(f),[4,r.response.traverse(g)];case 4:if((y=m.sent())instanceof Error)throw null==d||d.abort(),y;return[2,y];}});});}var F=function(){function t(t){J.interceptors.request.use(function(n){var r=n.url,o=n.method,i=n.body,s=i;if(t.onReportBeforeSend){var a=t.onReportBeforeSend({url:r,method:o,data:i?JSON.parse(i):null});s=(null==a?void 0:a.data)?JSON.stringify(a.data):null;}return"GET"!=o&&s?_e(_e({},n),{body:s}):n;});}return t.prototype.get=function(t,o){return n(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return[4,K(_e({url:t},o))];case 1:return[4,(n=r.sent()).json()];case 2:return i=r.sent(),[2,Promise.resolve({data:i,status:n.status,statusText:n.statusText,headers:n.headers})];}});});},t.prototype.post=function(t,o,i){return n(this,void 0,void 0,function(){var n,s;return r(this,function(r){switch(r.label){case 0:return[4,K(_e({url:t,body:o,method:"POST"},i))];case 1:return[4,(n=r.sent()).json()];case 2:return s=r.sent(),[2,Promise.resolve({data:s,status:n.status,statusText:n.statusText,headers:n.headers})];}});});},t;}(),G=function(){function t(t){this.appkey=t;}return t.prototype.getItem=function(t){try{return window.localStorage.getItem(this.getStoreKey(t));}catch(t){return"";}},t.prototype.removeItem=function(t){try{window.localStorage.removeItem(this.getStoreKey(t));}catch(t){}},t.prototype.setItem=function(t,e){try{window.localStorage.setItem(this.getStoreKey(t),e);}catch(t){}},t.prototype.setSessionItem=function(t,e){try{window.sessionStorage.setItem(this.getStoreKey(t),e);}catch(t){}},t.prototype.getSessionItem=function(t){try{return window.sessionStorage.getItem(this.getStoreKey(t));}catch(t){return"";}},t.prototype.getStoreKey=function(t){return o+this.appkey+"_"+t;},t.prototype.createDeviceId=function(){try{var t=window.localStorage.getItem(i);return t||(t=function(t){for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz0123456789",n="",r=0;r<t;r++){n+=e.charAt(Math.floor(Math.random()*e.length));}return n;}(32),window.localStorage.setItem(i,t)),t;}catch(t){return"";}},t.prototype.clear=function(){try{for(var t=window.localStorage.length,e=0;e<t;e++){var n=window.localStorage.key(e);(null==n?void 0:n.substr(0,9))==o&&window.localStorage.removeItem(n);}}catch(t){}},t.prototype.getStoreCount=function(){var t=0;try{t=window.localStorage.length;}catch(t){}return t;},t;}(),z="logid_start",W="4.5.14-web";return function(n){function r(t){var e=n.call(this,t)||this;e.qimei36="",e.uselessCycleTaskNum=0,e.underWeakNet=!1,e.pauseSearching=!1,e.send=function(t,n,r){e.storage.setItem(s,Date.now().toString()),e.network.post(e.uploadUrl||e.strategy.getUploadUrl(),t.data).then(function(r){var o;100==(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.result)?e.delayTime=1e3*r.data.delayTime:e.delayTime=0,n&&n(t.data),t.data.events.forEach(function(t){e.store.removeEvent(t).then(function(){e.removeSendingId(f(t.mapValue));});}),e.doCustomCycleTask();}).catch(function(n){var o=t.data.events;e.errorReport.reportError(n.code?n.code.toString():"600",n.message),r&&r(t.data);var i=JSON.parse(e.storage.getItem(a));o.forEach(function(t){i&&-1!=i.indexOf(f(t))&&e.store.insertEvent(t,function(t,n){t&&e.errorReport.reportError("604","insertEvent fail!");}),e.removeSendingId(f(t));}),e.monitorUploadFailed();});};var r,o,i=b();return e.isUnderIE8=i>0&&i<8,e.isUnderIE8||(e.isUnderIE=i>0,t.needInitQimei&&S(t.appkey,function(t){e.qimei36=t.q36;}),e.network=new F(t),e.storage=new G(t.appkey),e.initCommonInfo(t),e.store=new _(t.appkey,e.storage),e.errorReport=new g(e.config,e.commonInfo,"web",e.network),e.strategy=new y(null==t.needQueryConfig||t.needQueryConfig,e.config,e.commonInfo,e.storage,e.network),e.logidStartTime=e.storage.getItem(z),e.logidStartTime||(e.logidStartTime=Date.now().toString(),e.storage.setItem(z,e.logidStartTime)),r=e.logidStartTime,o=Date.now()-Number.parseFloat(r),Math.floor(o/864e5)>=365&&e.storage.clear(),e.initSession(t),e.onDirectUserAction("rqd_js_init",{}),setTimeout(function(){return e.lifeCycle.emit("init");},0),e.initDelayTime=t.delay?t.delay:1e3,e.cycleTask(e.initDelayTime)),e;}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e;}_t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r());}(r,n),r.prototype.initSession=function(t){var e=18e5;t.sessionDuration&&t.sessionDuration>3e4&&(e=t.sessionDuration),this.beaconSession=new w(this.storage,e,this);},r.prototype.initCommonInfo=function(t){var e=Number(this.storage.getItem(s));try{var n=JSON.parse(this.storage.getItem(a));(Date.now()-e>3e4||!n)&&this.storage.setItem(a,JSON.stringify([]));}catch(t){}t.uploadUrl&&(this.uploadUrl=t.uploadUrl+"?appkey="+t.appkey);var r=[window.screen.width,window.screen.height];window.devicePixelRatio&&r.push(window.devicePixelRatio),this.commonInfo={deviceId:this.storage.createDeviceId(),language:navigator&&navigator.language||"zh_CN",query:window.location.search,userAgent:navigator.userAgent,pixel:r.join("*"),channelID:t.channelID?String(t.channelID):"",openid:t.openid?String(t.openid):"",unid:t.unionid?String(t.unionid):"",sdkVersion:W},this.config.appVersion=t.versionCode?String(t.versionCode):"",this.config.strictMode=t.strictMode;},r.prototype.cycleTask=function(t){var e=this;this.intervalID=window.setInterval(function(){e.pauseSearching||e.store.getEvents().then(function(t){0==t.length&&(e.pauseSearching=!0);var n=[],r=JSON.parse(e.storage.getItem(a));r||(r=[]),t&&t.forEach(function(t){var e=f(t.mapValue);-1==r.indexOf(e)&&(n.push(t),r.push(e));}),0!=n.length&&(e.storage.setItem(a,JSON.stringify(r)),e._normalLogPipeline(e.assembleData(n)));}).catch(function(t){});},t);},r.prototype.onReport=function(t,e,n){var r=this;if(this.isUnderIE8)this.errorReport.reportError("601","UnderIE8");else{this.pauseSearching=!1;var o=this.generateData(t,e,n);if(n&&0==this.delayTime&&!this.underWeakNet)this._normalLogPipeline(this.assembleData(o));else{var i=o.shift();i&&this.store.insertEvent(i,function(t){t&&r.errorReport.reportError("604","insertEvent fail!");}).catch(function(t){r._normalLogPipeline(r.assembleData(o));});}}},r.prototype.onSendBeacon=function(t,e){if(this.isUnderIE)this.errorReport.reportError("605","UnderIE");else{this.pauseSearching=!1;var n=this.assembleData(this.generateData(t,e,!0));"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(this.uploadUrl||this.strategy.getUploadUrl(),JSON.stringify(n));}},r.prototype.generateData=function(t,n,r){var o=[],i="4.5.14-web_"+(r?"direct_log_id":"normal_log_id"),s=Number(this.storage.getItem(i));return s=s||1,n=_e(_e({},n),{A99:r?"Y":"N",A100:s.toString(),A72:W,A88:this.logidStartTime}),s++,this.storage.setItem(i,s.toString()),o.push({eventCode:t,eventTime:Date.now().toString(),mapValue:p(n,this.config.strictMode)}),o;},r.prototype.assembleData=function(t){var n=this.beaconSession.getSession();return{appVersion:this.config.appVersion?h(this.config.appVersion):"",sdkId:"js",sdkVersion:W,mainAppKey:this.config.appkey,platformId:3,common:p(_e(_e({},this.additionalParams),{A2:this.commonInfo.deviceId,A8:this.commonInfo.openid,A12:this.commonInfo.language,A17:this.commonInfo.pixel,A23:this.commonInfo.channelID,A50:this.commonInfo.unid,A76:n.sessionId,A101:this.commonInfo.userAgent,A102:window.location.href,A104:document.referrer,A119:this.commonInfo.query,A153:this.qimei36}),!1),events:t};},r.prototype.monitorUploadFailed=function(){this.uselessCycleTaskNum++,this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(6e4),this.underWeakNet=!0);},r.prototype.doCustomCycleTask=function(){this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(this.initDelayTime)),this.uselessCycleTaskNum=0,this.underWeakNet=!1;},r;}(v);});/***/},/***/"./lib/crypto.js":/*!***********************!*\
  466. !*** ./lib/crypto.js ***!
  467. \***********************/ /*! no static exports found */ /***/function libCryptoJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(module){var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");/*
  468. CryptoJS v3.1.2
  469. code.google.com/p/crypto-js
  470. (c) 2009-2013 by Jeff Mott. All rights reserved.
  471. code.google.com/p/crypto-js/wiki/License
  472. */var CryptoJS=CryptoJS||function(g,l){var e={},d=e.lib={},m=function m(){},k=d.Base={extend:function extend(a){m.prototype=this;var c=new m();a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments);});c.init.prototype=c;c.$super=this;return c;},create:function create(){var a=this.extend();a.init.apply(a,arguments);return a;},init:function init(){},mixIn:function mixIn(a){for(var c in a){a.hasOwnProperty(c)&&(this[c]=a[c]);}a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function clone(){return this.init.prototype.extend(this);}},p=d.WordArray=k.extend({init:function init(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length;},toString:function toString(a){return(a||n).stringify(this);},concat:function concat(a){var c=this.words,q=a.words,f=this.sigBytes;a=a.sigBytes;this.clamp();if(f%4)for(var b=0;b<a;b++){c[f+b>>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((f+b)%4);}else if(65535<q.length)for(b=0;b<a;b+=4){c[f+b>>>2]=q[b>>>2];}else c.push.apply(c,q);this.sigBytes+=a;return this;},clamp:function clamp(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<32-8*(c%4);a.length=g.ceil(c/4);},clone:function clone(){var a=k.clone.call(this);a.words=this.words.slice(0);return a;},random:function random(a){for(var c=[],b=0;b<a;b+=4){c.push(4294967296*g.random()|0);}return new p.init(c,a);}}),b=e.enc={},n=b.Hex={stringify:function stringify(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f<a;f++){var d=c[f>>>2]>>>24-8*(f%4)&255;b.push((d>>>4).toString(16));b.push((d&15).toString(16));}return b.join("");},parse:function parse(a){for(var c=a.length,b=[],f=0;f<c;f+=2){b[f>>>3]|=parseInt(a.substr(f,2),16)<<24-4*(f%8);}return new p.init(b,c/2);}},j=b.Latin1={stringify:function stringify(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f<a;f++){b.push(String.fromCharCode(c[f>>>2]>>>24-8*(f%4)&255));}return b.join("");},parse:function parse(a){for(var c=a.length,b=[],f=0;f<c;f++){b[f>>>2]|=(a.charCodeAt(f)&255)<<24-8*(f%4);}return new p.init(b,c);}},h=b.Utf8={stringify:function stringify(a){try{return decodeURIComponent(escape(j.stringify(a)));}catch(c){throw Error("Malformed UTF-8 data");}},parse:function parse(a){return j.parse(unescape(encodeURIComponent(a)));}},r=d.BufferedBlockAlgorithm=k.extend({reset:function reset(){this._data=new p.init();this._nDataBytes=0;},_append:function _append(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes;},_process:function _process(a){var c=this._data,b=c.words,f=c.sigBytes,d=this.blockSize,e=f/(4*d),e=a?g.ceil(e):g.max((e|0)-this._minBufferSize,0);a=e*d;f=g.min(4*a,f);if(a){for(var k=0;k<a;k+=d){this._doProcessBlock(b,k);}k=b.splice(0,a);c.sigBytes-=f;}return new p.init(k,f);},clone:function clone(){var a=k.clone.call(this);a._data=this._data.clone();return a;},_minBufferSize:0});d.Hasher=r.extend({cfg:k.extend(),init:function init(a){this.cfg=this.cfg.extend(a);this.reset();},reset:function reset(){r.reset.call(this);this._doReset();},update:function update(a){this._append(a);this._process();return this;},finalize:function finalize(a){a&&this._append(a);return this._doFinalize();},blockSize:16,_createHelper:function _createHelper(a){return function(b,d){return new a.init(d).finalize(b);};},_createHmacHelper:function _createHmacHelper(a){return function(b,d){return new s.HMAC.init(a,d).finalize(b);};}});var s=e.algo={};return e;}(Math);(function(){var g=CryptoJS,l=g.lib,e=l.WordArray,d=l.Hasher,m=[],l=g.algo.SHA1=d.extend({_doReset:function _doReset(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function _doProcessBlock(d,e){for(var b=this._hash.words,n=b[0],j=b[1],h=b[2],g=b[3],l=b[4],a=0;80>a;a++){if(16>a)m[a]=d[e+a]|0;else{var c=m[a-3]^m[a-8]^m[a-14]^m[a-16];m[a]=c<<1|c>>>31;}c=(n<<5|n>>>27)+l+m[a];c=20>a?c+((j&h|~j&g)+1518500249):40>a?c+((j^h^g)+1859775393):60>a?c+((j&h|j&g|h&g)-1894007588):c+((j^h^g)-899497514);l=g;g=h;h=j<<30|j>>>2;j=n;n=c;}b[0]=b[0]+n|0;b[1]=b[1]+j|0;b[2]=b[2]+h|0;b[3]=b[3]+g|0;b[4]=b[4]+l|0;},_doFinalize:function _doFinalize(){var d=this._data,e=d.words,b=8*this._nDataBytes,g=8*d.sigBytes;e[g>>>5]|=128<<24-g%32;e[(g+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(g+64>>>9<<4)+15]=b;d.sigBytes=4*e.length;this._process();return this._hash;},clone:function clone(){var e=d.clone.call(this);e._hash=this._hash.clone();return e;}});g.SHA1=d._createHelper(l);g.HmacSHA1=d._createHmacHelper(l);})();(function(){var g=CryptoJS,l=g.enc.Utf8;g.algo.HMAC=g.lib.Base.extend({init:function init(e,d){e=this._hasher=new e.init();"string"==typeof d&&(d=l.parse(d));var g=e.blockSize,k=4*g;d.sigBytes>k&&(d=e.finalize(d));d.clamp();for(var p=this._oKey=d.clone(),b=this._iKey=d.clone(),n=p.words,j=b.words,h=0;h<g;h++){n[h]^=1549556828,j[h]^=909522486;}p.sigBytes=b.sigBytes=k;this.reset();},reset:function reset(){var e=this._hasher;e.reset();e.update(this._iKey);},update:function update(e){this._hasher.update(e);return this;},finalize:function finalize(e){var d=this._hasher;e=d.finalize(e);d.reset();return d.finalize(this._oKey.clone().concat(e));}});})();(function(){// Shortcuts
  473. var C=CryptoJS;var C_lib=C.lib;var WordArray=C_lib.WordArray;var C_enc=C.enc;/**
  474. * Base64 encoding strategy.
  475. */C_enc.Base64={/**
  476. * Converts a word array to a Base64 string.
  477. *
  478. * @param {WordArray} wordArray The word array.
  479. *
  480. * @return {string} The Base64 string.
  481. *
  482. * @static
  483. *
  484. * @example
  485. *
  486. * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  487. */stringify:function stringify(wordArray){// Shortcuts
  488. var words=wordArray.words;var sigBytes=wordArray.sigBytes;var map=this._map;// Clamp excess bits
  489. wordArray.clamp();// Convert
  490. var base64Chars=[];for(var i=0;i<sigBytes;i+=3){var byte1=words[i>>>2]>>>24-i%4*8&0xff;var byte2=words[i+1>>>2]>>>24-(i+1)%4*8&0xff;var byte3=words[i+2>>>2]>>>24-(i+2)%4*8&0xff;var triplet=byte1<<16|byte2<<8|byte3;for(var j=0;j<4&&i+j*0.75<sigBytes;j++){base64Chars.push(map.charAt(triplet>>>6*(3-j)&0x3f));}}// Add padding
  491. var paddingChar=map.charAt(64);if(paddingChar){while(base64Chars.length%4){base64Chars.push(paddingChar);}}return base64Chars.join('');},/**
  492. * Converts a Base64 string to a word array.
  493. *
  494. * @param {string} base64Str The Base64 string.
  495. *
  496. * @return {WordArray} The word array.
  497. *
  498. * @static
  499. *
  500. * @example
  501. *
  502. * var wordArray = CryptoJS.enc.Base64.parse(base64String);
  503. */parse:function parse(base64Str){// Shortcuts
  504. var base64StrLength=base64Str.length;var map=this._map;// Ignore padding
  505. var paddingChar=map.charAt(64);if(paddingChar){var paddingIndex=base64Str.indexOf(paddingChar);if(paddingIndex!=-1){base64StrLength=paddingIndex;}}// Convert
  506. var words=[];var nBytes=0;for(var i=0;i<base64StrLength;i++){if(i%4){var bits1=map.indexOf(base64Str.charAt(i-1))<<i%4*2;var bits2=map.indexOf(base64Str.charAt(i))>>>6-i%4*2;words[nBytes>>>2]|=(bits1|bits2)<<24-nBytes%4*8;nBytes++;}}return WordArray.create(words,nBytes);},_map:'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='};})();if(_typeof(module)==='object'){module.exports=CryptoJS;}else{window.CryptoJS=CryptoJS;}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../node_modules/webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./lib/json2xml.js":/*!*************************!*\
  507. !*** ./lib/json2xml.js ***!
  508. \*************************/ /*! no static exports found */ /***/function libJson2xmlJs(module,exports,__webpack_require__){var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");//copyright Ryan Day 2010 <http://ryanday.org>, Joscha Feth 2013 <http://www.feth.com> [MIT Licensed]
  509. var element_start_char="a-zA-Z_\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FFF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";var element_non_start_char="-.0-9\xB7\u0300-\u036F\u203F\u2040";var element_replace=new RegExp("^([^"+element_start_char+"])|^((x|X)(m|M)(l|L))|([^"+element_start_char+element_non_start_char+"])","g");var not_safe_in_xml=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm;var objKeys=function objKeys(obj){var l=[];if(obj instanceof Object){for(var k in obj){if(obj.hasOwnProperty(k)){l.push(k);}}}return l;};var process_to_xml=function process_to_xml(node_data,options){var makeNode=function makeNode(name,content,attributes,level,hasSubNodes){var indent_value=options.indent!==undefined?options.indent:"\t";var indent=options.prettyPrint?'\n'+new Array(level).join(indent_value):'';if(options.removeIllegalNameCharacters){name=name.replace(element_replace,'_');}var node=[indent,'<',name,attributes||''];if(content&&content.length>0){node.push('>');node.push(content);hasSubNodes&&node.push(indent);node.push('</');node.push(name);node.push('>');}else{node.push('/>');}return node.join('');};return function fn(node_data,node_descriptor,level){var type=_typeof(node_data);if(Array.isArray?Array.isArray(node_data):node_data instanceof Array){type='array';}else if(node_data instanceof Date){type='date';}switch(type){//if value is an array create child nodes from values
  510. case'array':var ret=[];node_data.map(function(v){ret.push(fn(v,1,level+1));//entries that are values of an array are the only ones that can be special node descriptors
  511. });options.prettyPrint&&ret.push('\n');return ret.join('');case'date':// cast dates to ISO 8601 date (soap likes it)
  512. return node_data.toJSON?node_data.toJSON():node_data+'';case'object':var nodes=[];for(var name in node_data){if(node_data.hasOwnProperty(name)){if(node_data[name]instanceof Array){for(var j=0;j<node_data[name].length;j++){if(node_data[name].hasOwnProperty(j)){nodes.push(makeNode(name,fn(node_data[name][j],0,level+1),null,level+1,objKeys(node_data[name][j]).length));}}}else{nodes.push(makeNode(name,fn(node_data[name],0,level+1),null,level+1));}}}options.prettyPrint&&nodes.length>0&&nodes.push('\n');return nodes.join('');case'function':return node_data();default:return options.escape?esc(node_data):''+node_data;}}(node_data,0,0);};var xml_header=function xml_header(standalone){var ret=['<?xml version="1.0" encoding="UTF-8"'];if(standalone){ret.push(' standalone="yes"');}ret.push('?>');return ret.join('');};function esc(str){return(''+str).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/'/g,'&apos;').replace(/"/g,'&quot;').replace(not_safe_in_xml,'');}module.exports=function(obj,options){if(!options){options={xmlHeader:{standalone:true},prettyPrint:true,indent:" ",escape:true};}if(typeof obj=='string'){try{obj=JSON.parse(obj.toString());}catch(e){return false;}}var xmlheader='';var docType='';if(options){if(_typeof(options)=='object'){// our config is an object
  513. if(options.xmlHeader){// the user wants an xml header
  514. xmlheader=xml_header(!!options.xmlHeader.standalone);}if(typeof options.docType!='undefined'){docType='<!DOCTYPE '+options.docType+'>';}}else{// our config is a boolean value, so just add xml header
  515. xmlheader=xml_header();}}options=options||{};var ret=[xmlheader,options.prettyPrint&&docType?'\n':'',docType,process_to_xml(obj,options)];return ret.join('').replace(/\n{2,}/g,'\n').replace(/\s+$/g,'');};/***/},/***/"./lib/md5.js":/*!********************!*\
  516. !*** ./lib/md5.js ***!
  517. \********************/ /*! no static exports found */ /***/function libMd5Js(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(process,global,module){var __WEBPACK_AMD_DEFINE_RESULT__;var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");/* https://github.com/emn178/js-md5 */(function(){var ERROR='input is invalid type';var WINDOW=(typeof window==="undefined"?"undefined":_typeof(window))==='object';var root=WINDOW?window:{};if(root.JS_MD5_NO_WINDOW){WINDOW=false;}var WEB_WORKER=!WINDOW&&(typeof self==="undefined"?"undefined":_typeof(self))==='object';var NODE_JS=!root.JS_MD5_NO_NODE_JS&&(typeof process==="undefined"?"undefined":_typeof(process))==='object'&&process.versions&&process.versions.node;if(NODE_JS){root=global;}else if(WEB_WORKER){root=self;}var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&_typeof(module)==='object'&&module.exports;var AMD=__webpack_require__(/*! !webpack amd options */"./node_modules/webpack/buildin/amd-options.js");var ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer!=='undefined';var HEX_CHARS='0123456789abcdef'.split('');var EXTRA=[128,32768,8388608,-2147483648];var SHIFT=[0,8,16,24];var OUTPUT_TYPES=['hex','array','digest','buffer','arrayBuffer','base64'];var BASE64_ENCODE_CHAR='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');var blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer);blocks=new Uint32Array(buffer);}if(root.JS_MD5_NO_NODE_JS||!Array.isArray){Array.isArray=function(obj){return Object.prototype.toString.call(obj)==='[object Array]';};}if(ARRAY_BUFFER&&(root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)){ArrayBuffer.isView=function(obj){return _typeof(obj)==='object'&&obj.buffer&&obj.buffer.constructor===ArrayBuffer;};}/**
  518. * @method hex
  519. * @memberof md5
  520. * @description Output hash as hex string
  521. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  522. * @returns {String} Hex string
  523. * @example
  524. * md5.hex('The quick brown fox jumps over the lazy dog');
  525. * // equal to
  526. * md5('The quick brown fox jumps over the lazy dog');
  527. */ /**
  528. * @method digest
  529. * @memberof md5
  530. * @description Output hash as bytes array
  531. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  532. * @returns {Array} Bytes array
  533. * @example
  534. * md5.digest('The quick brown fox jumps over the lazy dog');
  535. */ /**
  536. * @method array
  537. * @memberof md5
  538. * @description Output hash as bytes array
  539. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  540. * @returns {Array} Bytes array
  541. * @example
  542. * md5.array('The quick brown fox jumps over the lazy dog');
  543. */ /**
  544. * @method arrayBuffer
  545. * @memberof md5
  546. * @description Output hash as ArrayBuffer
  547. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  548. * @returns {ArrayBuffer} ArrayBuffer
  549. * @example
  550. * md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
  551. */ /**
  552. * @method buffer
  553. * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
  554. * @memberof md5
  555. * @description Output hash as ArrayBuffer
  556. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  557. * @returns {ArrayBuffer} ArrayBuffer
  558. * @example
  559. * md5.buffer('The quick brown fox jumps over the lazy dog');
  560. */ /**
  561. * @method base64
  562. * @memberof md5
  563. * @description Output hash as base64 string
  564. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  565. * @returns {String} base64 string
  566. * @example
  567. * md5.base64('The quick brown fox jumps over the lazy dog');
  568. */var createOutputMethod=function createOutputMethod(outputType){return function(message,isBinStr){return new Md5(true).update(message,isBinStr)[outputType]();};};/**
  569. * @method create
  570. * @memberof md5
  571. * @description Create Md5 object
  572. * @returns {Md5} Md5 object.
  573. * @example
  574. * var hash = md5.create();
  575. */ /**
  576. * @method update
  577. * @memberof md5
  578. * @description Create and update Md5 object
  579. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  580. * @returns {Md5} Md5 object.
  581. * @example
  582. * var hash = md5.update('The quick brown fox jumps over the lazy dog');
  583. * // equal to
  584. * var hash = md5.create();
  585. * hash.update('The quick brown fox jumps over the lazy dog');
  586. */var createMethod=function createMethod(){var method=createOutputMethod('hex');if(NODE_JS){method=nodeWrap(method);}method.getCtx=method.create=function(){return new Md5();};method.update=function(message){return method.create().update(message);};for(var i=0;i<OUTPUT_TYPES.length;++i){var type=OUTPUT_TYPES[i];method[type]=createOutputMethod(type);}return method;};var nodeWrap=function nodeWrap(method){var crypto=eval("require('crypto')");var Buffer=eval("require('buffer').Buffer");var nodeMethod=function nodeMethod(message){if(typeof message==='string'){return crypto.createHash('md5').update(message,'utf8').digest('hex');}else{if(message===null||message===undefined){throw ERROR;}else if(message.constructor===ArrayBuffer){message=new Uint8Array(message);}}if(Array.isArray(message)||ArrayBuffer.isView(message)||message.constructor===Buffer){return crypto.createHash('md5').update(new Buffer(message)).digest('hex');}else{return method(message);}};return nodeMethod;};/**
  587. * Md5 class
  588. * @class Md5
  589. * @description This is internal class.
  590. * @see {@link md5.create}
  591. */function Md5(sharedMemory){if(sharedMemory){blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0;this.blocks=blocks;this.buffer8=buffer8;}else{if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);this.buffer8=new Uint8Array(buffer);this.blocks=new Uint32Array(buffer);}else{this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];}}this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0;this.finalized=this.hashed=false;this.first=true;}/**
  592. * @method update
  593. * @memberof Md5
  594. * @instance
  595. * @description Update hash
  596. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  597. * @returns {Md5} Md5 object.
  598. * @see {@link md5.update}
  599. */Md5.prototype.update=function(message,isBinStr){if(this.finalized){return;}var code,index=0,i,length=message.length,blocks=this.blocks;var buffer8=this.buffer8;while(index<length){if(this.hashed){this.hashed=false;blocks[0]=blocks[16];blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0;}if(ARRAY_BUFFER){for(i=this.start;index<length&&i<64;++index){code=message.charCodeAt(index);if(isBinStr||code<0x80){buffer8[i++]=code;}else if(code<0x800){buffer8[i++]=0xc0|code>>6;buffer8[i++]=0x80|code&0x3f;}else if(code<0xd800||code>=0xe000){buffer8[i++]=0xe0|code>>12;buffer8[i++]=0x80|code>>6&0x3f;buffer8[i++]=0x80|code&0x3f;}else{code=0x10000+((code&0x3ff)<<10|message.charCodeAt(++index)&0x3ff);buffer8[i++]=0xf0|code>>18;buffer8[i++]=0x80|code>>12&0x3f;buffer8[i++]=0x80|code>>6&0x3f;buffer8[i++]=0x80|code&0x3f;}}}else{for(i=this.start;index<length&&i<64;++index){code=message.charCodeAt(index);if(isBinStr||code<0x80){blocks[i>>2]|=code<<SHIFT[i++&3];}else if(code<0x800){blocks[i>>2]|=(0xc0|code>>6)<<SHIFT[i++&3];blocks[i>>2]|=(0x80|code&0x3f)<<SHIFT[i++&3];}else if(code<0xd800||code>=0xe000){blocks[i>>2]|=(0xe0|code>>12)<<SHIFT[i++&3];blocks[i>>2]|=(0x80|code>>6&0x3f)<<SHIFT[i++&3];blocks[i>>2]|=(0x80|code&0x3f)<<SHIFT[i++&3];}else{code=0x10000+((code&0x3ff)<<10|message.charCodeAt(++index)&0x3ff);blocks[i>>2]|=(0xf0|code>>18)<<SHIFT[i++&3];blocks[i>>2]|=(0x80|code>>12&0x3f)<<SHIFT[i++&3];blocks[i>>2]|=(0x80|code>>6&0x3f)<<SHIFT[i++&3];blocks[i>>2]|=(0x80|code&0x3f)<<SHIFT[i++&3];}}}this.lastByteIndex=i;this.bytes+=i-this.start;if(i>=64){this.start=i-64;this.hash();this.hashed=true;}else{this.start=i;}}if(this.bytes>4294967295){this.hBytes+=this.bytes/4294967296<<0;this.bytes=this.bytes%4294967296;}return this;};Md5.prototype.finalize=function(){if(this.finalized){return;}this.finalized=true;var blocks=this.blocks,i=this.lastByteIndex;blocks[i>>2]|=EXTRA[i&3];if(i>=56){if(!this.hashed){this.hash();}blocks[0]=blocks[16];blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0;}blocks[14]=this.bytes<<3;blocks[15]=this.hBytes<<3|this.bytes>>>29;this.hash();};Md5.prototype.hash=function(){var a,b,c,d,bc,da,blocks=this.blocks;if(this.first){a=blocks[0]-680876937;a=(a<<7|a>>>25)-271733879<<0;d=(-1732584194^a&2004318071)+blocks[1]-117830708;d=(d<<12|d>>>20)+a<<0;c=(-271733879^d&(a^-271733879))+blocks[2]-1126478375;c=(c<<17|c>>>15)+d<<0;b=(a^c&(d^a))+blocks[3]-1316259209;b=(b<<22|b>>>10)+c<<0;}else{a=this.h0;b=this.h1;c=this.h2;d=this.h3;a+=(d^b&(c^d))+blocks[0]-680876936;a=(a<<7|a>>>25)+b<<0;d+=(c^a&(b^c))+blocks[1]-389564586;d=(d<<12|d>>>20)+a<<0;c+=(b^d&(a^b))+blocks[2]+606105819;c=(c<<17|c>>>15)+d<<0;b+=(a^c&(d^a))+blocks[3]-1044525330;b=(b<<22|b>>>10)+c<<0;}a+=(d^b&(c^d))+blocks[4]-176418897;a=(a<<7|a>>>25)+b<<0;d+=(c^a&(b^c))+blocks[5]+1200080426;d=(d<<12|d>>>20)+a<<0;c+=(b^d&(a^b))+blocks[6]-1473231341;c=(c<<17|c>>>15)+d<<0;b+=(a^c&(d^a))+blocks[7]-45705983;b=(b<<22|b>>>10)+c<<0;a+=(d^b&(c^d))+blocks[8]+1770035416;a=(a<<7|a>>>25)+b<<0;d+=(c^a&(b^c))+blocks[9]-1958414417;d=(d<<12|d>>>20)+a<<0;c+=(b^d&(a^b))+blocks[10]-42063;c=(c<<17|c>>>15)+d<<0;b+=(a^c&(d^a))+blocks[11]-1990404162;b=(b<<22|b>>>10)+c<<0;a+=(d^b&(c^d))+blocks[12]+1804603682;a=(a<<7|a>>>25)+b<<0;d+=(c^a&(b^c))+blocks[13]-40341101;d=(d<<12|d>>>20)+a<<0;c+=(b^d&(a^b))+blocks[14]-1502002290;c=(c<<17|c>>>15)+d<<0;b+=(a^c&(d^a))+blocks[15]+1236535329;b=(b<<22|b>>>10)+c<<0;a+=(c^d&(b^c))+blocks[1]-165796510;a=(a<<5|a>>>27)+b<<0;d+=(b^c&(a^b))+blocks[6]-1069501632;d=(d<<9|d>>>23)+a<<0;c+=(a^b&(d^a))+blocks[11]+643717713;c=(c<<14|c>>>18)+d<<0;b+=(d^a&(c^d))+blocks[0]-373897302;b=(b<<20|b>>>12)+c<<0;a+=(c^d&(b^c))+blocks[5]-701558691;a=(a<<5|a>>>27)+b<<0;d+=(b^c&(a^b))+blocks[10]+38016083;d=(d<<9|d>>>23)+a<<0;c+=(a^b&(d^a))+blocks[15]-660478335;c=(c<<14|c>>>18)+d<<0;b+=(d^a&(c^d))+blocks[4]-405537848;b=(b<<20|b>>>12)+c<<0;a+=(c^d&(b^c))+blocks[9]+568446438;a=(a<<5|a>>>27)+b<<0;d+=(b^c&(a^b))+blocks[14]-1019803690;d=(d<<9|d>>>23)+a<<0;c+=(a^b&(d^a))+blocks[3]-187363961;c=(c<<14|c>>>18)+d<<0;b+=(d^a&(c^d))+blocks[8]+1163531501;b=(b<<20|b>>>12)+c<<0;a+=(c^d&(b^c))+blocks[13]-1444681467;a=(a<<5|a>>>27)+b<<0;d+=(b^c&(a^b))+blocks[2]-51403784;d=(d<<9|d>>>23)+a<<0;c+=(a^b&(d^a))+blocks[7]+1735328473;c=(c<<14|c>>>18)+d<<0;b+=(d^a&(c^d))+blocks[12]-1926607734;b=(b<<20|b>>>12)+c<<0;bc=b^c;a+=(bc^d)+blocks[5]-378558;a=(a<<4|a>>>28)+b<<0;d+=(bc^a)+blocks[8]-2022574463;d=(d<<11|d>>>21)+a<<0;da=d^a;c+=(da^b)+blocks[11]+1839030562;c=(c<<16|c>>>16)+d<<0;b+=(da^c)+blocks[14]-35309556;b=(b<<23|b>>>9)+c<<0;bc=b^c;a+=(bc^d)+blocks[1]-1530992060;a=(a<<4|a>>>28)+b<<0;d+=(bc^a)+blocks[4]+1272893353;d=(d<<11|d>>>21)+a<<0;da=d^a;c+=(da^b)+blocks[7]-155497632;c=(c<<16|c>>>16)+d<<0;b+=(da^c)+blocks[10]-1094730640;b=(b<<23|b>>>9)+c<<0;bc=b^c;a+=(bc^d)+blocks[13]+681279174;a=(a<<4|a>>>28)+b<<0;d+=(bc^a)+blocks[0]-358537222;d=(d<<11|d>>>21)+a<<0;da=d^a;c+=(da^b)+blocks[3]-722521979;c=(c<<16|c>>>16)+d<<0;b+=(da^c)+blocks[6]+76029189;b=(b<<23|b>>>9)+c<<0;bc=b^c;a+=(bc^d)+blocks[9]-640364487;a=(a<<4|a>>>28)+b<<0;d+=(bc^a)+blocks[12]-421815835;d=(d<<11|d>>>21)+a<<0;da=d^a;c+=(da^b)+blocks[15]+530742520;c=(c<<16|c>>>16)+d<<0;b+=(da^c)+blocks[2]-995338651;b=(b<<23|b>>>9)+c<<0;a+=(c^(b|~d))+blocks[0]-198630844;a=(a<<6|a>>>26)+b<<0;d+=(b^(a|~c))+blocks[7]+1126891415;d=(d<<10|d>>>22)+a<<0;c+=(a^(d|~b))+blocks[14]-1416354905;c=(c<<15|c>>>17)+d<<0;b+=(d^(c|~a))+blocks[5]-57434055;b=(b<<21|b>>>11)+c<<0;a+=(c^(b|~d))+blocks[12]+1700485571;a=(a<<6|a>>>26)+b<<0;d+=(b^(a|~c))+blocks[3]-1894986606;d=(d<<10|d>>>22)+a<<0;c+=(a^(d|~b))+blocks[10]-1051523;c=(c<<15|c>>>17)+d<<0;b+=(d^(c|~a))+blocks[1]-2054922799;b=(b<<21|b>>>11)+c<<0;a+=(c^(b|~d))+blocks[8]+1873313359;a=(a<<6|a>>>26)+b<<0;d+=(b^(a|~c))+blocks[15]-30611744;d=(d<<10|d>>>22)+a<<0;c+=(a^(d|~b))+blocks[6]-1560198380;c=(c<<15|c>>>17)+d<<0;b+=(d^(c|~a))+blocks[13]+1309151649;b=(b<<21|b>>>11)+c<<0;a+=(c^(b|~d))+blocks[4]-145523070;a=(a<<6|a>>>26)+b<<0;d+=(b^(a|~c))+blocks[11]-1120210379;d=(d<<10|d>>>22)+a<<0;c+=(a^(d|~b))+blocks[2]+718787259;c=(c<<15|c>>>17)+d<<0;b+=(d^(c|~a))+blocks[9]-343485551;b=(b<<21|b>>>11)+c<<0;if(this.first){this.h0=a+1732584193<<0;this.h1=b-271733879<<0;this.h2=c-1732584194<<0;this.h3=d+271733878<<0;this.first=false;}else{this.h0=this.h0+a<<0;this.h1=this.h1+b<<0;this.h2=this.h2+c<<0;this.h3=this.h3+d<<0;}};/**
  600. * @method hex
  601. * @memberof Md5
  602. * @instance
  603. * @description Output hash as hex string
  604. * @returns {String} Hex string
  605. * @see {@link md5.hex}
  606. * @example
  607. * hash.hex();
  608. */Md5.prototype.hex=function(){this.finalize();var h0=this.h0,h1=this.h1,h2=this.h2,h3=this.h3;return HEX_CHARS[h0>>4&0x0F]+HEX_CHARS[h0&0x0F]+HEX_CHARS[h0>>12&0x0F]+HEX_CHARS[h0>>8&0x0F]+HEX_CHARS[h0>>20&0x0F]+HEX_CHARS[h0>>16&0x0F]+HEX_CHARS[h0>>28&0x0F]+HEX_CHARS[h0>>24&0x0F]+HEX_CHARS[h1>>4&0x0F]+HEX_CHARS[h1&0x0F]+HEX_CHARS[h1>>12&0x0F]+HEX_CHARS[h1>>8&0x0F]+HEX_CHARS[h1>>20&0x0F]+HEX_CHARS[h1>>16&0x0F]+HEX_CHARS[h1>>28&0x0F]+HEX_CHARS[h1>>24&0x0F]+HEX_CHARS[h2>>4&0x0F]+HEX_CHARS[h2&0x0F]+HEX_CHARS[h2>>12&0x0F]+HEX_CHARS[h2>>8&0x0F]+HEX_CHARS[h2>>20&0x0F]+HEX_CHARS[h2>>16&0x0F]+HEX_CHARS[h2>>28&0x0F]+HEX_CHARS[h2>>24&0x0F]+HEX_CHARS[h3>>4&0x0F]+HEX_CHARS[h3&0x0F]+HEX_CHARS[h3>>12&0x0F]+HEX_CHARS[h3>>8&0x0F]+HEX_CHARS[h3>>20&0x0F]+HEX_CHARS[h3>>16&0x0F]+HEX_CHARS[h3>>28&0x0F]+HEX_CHARS[h3>>24&0x0F];};/**
  609. * @method toString
  610. * @memberof Md5
  611. * @instance
  612. * @description Output hash as hex string
  613. * @returns {String} Hex string
  614. * @see {@link md5.hex}
  615. * @example
  616. * hash.toString();
  617. */Md5.prototype.toString=Md5.prototype.hex;/**
  618. * @method digest
  619. * @memberof Md5
  620. * @instance
  621. * @description Output hash as bytes array
  622. * @returns {Array} Bytes array
  623. * @see {@link md5.digest}
  624. * @example
  625. * hash.digest();
  626. */Md5.prototype.digest=function(format){if(format==='hex')return this.hex();this.finalize();var h0=this.h0,h1=this.h1,h2=this.h2,h3=this.h3;var res=[h0&0xFF,h0>>8&0xFF,h0>>16&0xFF,h0>>24&0xFF,h1&0xFF,h1>>8&0xFF,h1>>16&0xFF,h1>>24&0xFF,h2&0xFF,h2>>8&0xFF,h2>>16&0xFF,h2>>24&0xFF,h3&0xFF,h3>>8&0xFF,h3>>16&0xFF,h3>>24&0xFF];return res;};/**
  627. * @method array
  628. * @memberof Md5
  629. * @instance
  630. * @description Output hash as bytes array
  631. * @returns {Array} Bytes array
  632. * @see {@link md5.array}
  633. * @example
  634. * hash.array();
  635. */Md5.prototype.array=Md5.prototype.digest;/**
  636. * @method arrayBuffer
  637. * @memberof Md5
  638. * @instance
  639. * @description Output hash as ArrayBuffer
  640. * @returns {ArrayBuffer} ArrayBuffer
  641. * @see {@link md5.arrayBuffer}
  642. * @example
  643. * hash.arrayBuffer();
  644. */Md5.prototype.arrayBuffer=function(){this.finalize();var buffer=new ArrayBuffer(16);var blocks=new Uint32Array(buffer);blocks[0]=this.h0;blocks[1]=this.h1;blocks[2]=this.h2;blocks[3]=this.h3;return buffer;};/**
  645. * @method buffer
  646. * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
  647. * @memberof Md5
  648. * @instance
  649. * @description Output hash as ArrayBuffer
  650. * @returns {ArrayBuffer} ArrayBuffer
  651. * @see {@link md5.buffer}
  652. * @example
  653. * hash.buffer();
  654. */Md5.prototype.buffer=Md5.prototype.arrayBuffer;/**
  655. * @method base64
  656. * @memberof Md5
  657. * @instance
  658. * @description Output hash as base64 string
  659. * @returns {String} base64 string
  660. * @see {@link md5.base64}
  661. * @example
  662. * hash.base64();
  663. */Md5.prototype.base64=function(){var v1,v2,v3,base64Str='',bytes=this.array();for(var i=0;i<15;){v1=bytes[i++];v2=bytes[i++];v3=bytes[i++];base64Str+=BASE64_ENCODE_CHAR[v1>>>2]+BASE64_ENCODE_CHAR[(v1<<4|v2>>>4)&63]+BASE64_ENCODE_CHAR[(v2<<2|v3>>>6)&63]+BASE64_ENCODE_CHAR[v3&63];}v1=bytes[i];base64Str+=BASE64_ENCODE_CHAR[v1>>>2]+BASE64_ENCODE_CHAR[v1<<4&63]+'==';return base64Str;};var exports=createMethod();if(COMMON_JS){module.exports=exports;}else{/**
  664. * @method md5
  665. * @description Md5 hash function, export to global in browsers.
  666. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
  667. * @returns {String} md5 hashes
  668. * @example
  669. * md5(''); // d41d8cd98f00b204e9800998ecf8427e
  670. * md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
  671. * md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
  672. *
  673. * // It also supports UTF-8 encoding
  674. * md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
  675. *
  676. * // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
  677. * md5([]); // d41d8cd98f00b204e9800998ecf8427e
  678. * md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
  679. */root.md5=exports;if(AMD){!(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports;}.call(exports,__webpack_require__,exports,module),__WEBPACK_AMD_DEFINE_RESULT__!==undefined&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__));}}})();/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../node_modules/process/browser.js */"./node_modules/process/browser.js"),__webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),__webpack_require__(/*! ./../node_modules/webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./lib/request.js":/*!************************!*\
  680. !*** ./lib/request.js ***!
  681. \************************/ /*! no static exports found */ /***/function libRequestJs(module,exports,__webpack_require__){var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");var stringifyPrimitive=function stringifyPrimitive(v){switch(_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};var queryStringify=function queryStringify(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(_typeof(obj)==='object'){return Object.keys(obj).map(function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(Array.isArray(obj[k])){return obj[k].map(function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).filter(Boolean).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var xhrRes=function xhrRes(err,xhr,body){var headers={};xhr.getAllResponseHeaders().trim().split('\n').forEach(function(item){if(item){var index=item.indexOf(':');var key=item.substr(0,index).trim().toLowerCase();var val=item.substr(index+1).trim();headers[key]=val;}});return{error:err,statusCode:xhr.status,statusMessage:xhr.statusText,headers:headers,body:body};};var xhrBody=function xhrBody(xhr,dataType){return!dataType&&dataType==='text'?xhr.responseText:xhr.response;};var request=function request(opt,callback){// method
  682. var method=(opt.method||'GET').toUpperCase();// url、qs
  683. var url=opt.url;if(opt.qs){var qsStr=queryStringify(opt.qs);if(qsStr){url+=(url.indexOf('?')===-1?'?':'&')+qsStr;}}// 创建 ajax 实例
  684. var xhr=new XMLHttpRequest();xhr.open(method,url,true);xhr.responseType=opt.dataType||'text';// 处理 xhrFields 属性
  685. if(opt.xhrFields){for(var xhrField in opt.xhrFields){xhr[xhrField]=opt.xhrFields[xhrField];}}// 处理 headers
  686. var headers=opt.headers;if(headers){for(var key in headers){if(headers.hasOwnProperty(key)&&key.toLowerCase()!=='content-length'&&key.toLowerCase()!=='user-agent'&&key.toLowerCase()!=='origin'&&key.toLowerCase()!=='host'){xhr.setRequestHeader(key,headers[key]);}}}// onprogress
  687. if(opt.onProgress&&xhr.upload)xhr.upload.onprogress=opt.onProgress;if(opt.onDownloadProgress)xhr.onprogress=opt.onDownloadProgress;// timeout
  688. if(opt.timeout)xhr.timeout=opt.timeout;xhr.ontimeout=function(event){var error=new Error('timeout');callback(xhrRes(error,xhr));};// success 2xx/3xx/4xx
  689. xhr.onload=function(){callback(xhrRes(null,xhr,xhrBody(xhr,opt.dataType)));};// error 5xx/0 (网络错误、跨域报错、Https connect-src 限制的报错时 statusCode 为 0)
  690. xhr.onerror=function(err){var body=xhrBody(xhr,opt.dataType);if(body){// 5xx
  691. callback(xhrRes(null,xhr,body));}else{// 0
  692. var error=xhr.statusText;if(!error&&xhr.status===0)error=new Error('CORS blocked or network error');callback(xhrRes(error,xhr,body));}};// send
  693. xhr.send(opt.body||'');// 返回 ajax 实例,用于外部调用 xhr.abort
  694. return xhr;};module.exports=request;/***/},/***/"./lib/xml2json.js":/*!*************************!*\
  695. !*** ./lib/xml2json.js ***!
  696. \*************************/ /*! no static exports found */ /***/function libXml2jsonJs(module,exports,__webpack_require__){/* Copyright 2015 William Summers, MetaTribal LLC
  697. * adapted from https://developer.mozilla.org/en-US/docs/JXON
  698. *
  699. * Licensed under the MIT License, Version 2.0 (the "License");
  700. * you may not use this file except in compliance with the License.
  701. * You may obtain a copy of the License at
  702. *
  703. * https://opensource.org/licenses/MIT
  704. *
  705. * Unless required by applicable law or agreed to in writing, software
  706. * distributed under the License is distributed on an "AS IS" BASIS,
  707. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  708. * See the License for the specific language governing permissions and
  709. * limitations under the License.
  710. */ /**
  711. * @author William Summers
  712. * https://github.com/metatribal/xmlToJSON
  713. */var DOMParser=__webpack_require__(/*! @xmldom/xmldom */"./node_modules/@xmldom/xmldom/lib/index.js").DOMParser;var xmlToJSON=function(){this.version="1.3.5";var options={// set up the default options
  714. mergeCDATA:true,// extract cdata and merge with text
  715. normalize:true,// collapse multiple spaces to single space
  716. stripElemPrefix:true// for elements of same name in diff namespaces, you can enable namespaces and access the nskey property
  717. };var prefixMatch=new RegExp(/(?!xmlns)^.*:/);this.grokType=function(sValue){if(/^\s*$/.test(sValue)){return null;}if(/^(?:true|false)$/i.test(sValue)){return sValue.toLowerCase()==="true";}if(isFinite(sValue)){return parseFloat(sValue);}return sValue;};this.parseString=function(xmlString,opt){if(xmlString){var xml=this.stringToXML(xmlString);if(xml.getElementsByTagName('parsererror').length){return null;}else{return this.parseXML(xml,opt);}}else{return null;}};this.parseXML=function(oXMLParent,opt){// initialize options
  718. for(var key in opt){options[key]=opt[key];}var vResult={},nLength=0,sCollectedTxt="";// iterate over the children
  719. var childNum=oXMLParent.childNodes.length;if(childNum){for(var oNode,sProp,vContent,nItem=0;nItem<oXMLParent.childNodes.length;nItem++){oNode=oXMLParent.childNodes.item(nItem);if(oNode.nodeType===4){if(options.mergeCDATA){sCollectedTxt+=oNode.nodeValue;}}/* nodeType is "CDATASection" (4) */else if(oNode.nodeType===3){sCollectedTxt+=oNode.nodeValue;}/* nodeType is "Text" (3) */else if(oNode.nodeType===1){/* nodeType is "Element" (1) */if(nLength===0){vResult={};}// using nodeName to support browser (IE) implementation with no 'localName' property
  720. if(options.stripElemPrefix){sProp=oNode.nodeName.replace(prefixMatch,'');}else{sProp=oNode.nodeName;}vContent=xmlToJSON.parseXML(oNode);if(vResult.hasOwnProperty(sProp)){if(vResult[sProp].constructor!==Array){vResult[sProp]=[vResult[sProp]];}vResult[sProp].push(vContent);}else{vResult[sProp]=vContent;nLength++;}}}}if(!Object.keys(vResult).length){// vResult = sCollectedTxt.replace(trimMatch, '') || ''; // by carsonxu 修复 getBucket返回的 Key 是 " /" 这种场景
  721. vResult=sCollectedTxt||'';}return vResult;};// Convert xmlDocument to a string
  722. // Returns null on failure
  723. this.xmlToString=function(xmlDoc){try{var xmlString=xmlDoc.xml?xmlDoc.xml:new XMLSerializer().serializeToString(xmlDoc);return xmlString;}catch(err){return null;}};// Convert a string to XML Node Structure
  724. // Returns null on failure
  725. this.stringToXML=function(xmlString){try{var xmlDoc=null;if(window.DOMParser){var parser=new DOMParser();xmlDoc=parser.parseFromString(xmlString,"text/xml");return xmlDoc;}else{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.loadXML(xmlString);return xmlDoc;}}catch(e){return null;}};return this;}.call({});var xml2json=function xml2json(xmlString){return xmlToJSON.parseString(xmlString);};module.exports=xml2json;/***/},/***/"./node_modules/@babel/runtime/helpers/classCallCheck.js":/*!***************************************************************!*\
  726. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  727. \***************************************************************/ /*! no static exports found */ /***/function node_modulesBabelRuntimeHelpersClassCallCheckJs(module,exports){function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}module.exports=_classCallCheck,module.exports.__esModule=true,module.exports["default"]=module.exports;/***/},/***/"./node_modules/@babel/runtime/helpers/createClass.js":/*!************************************************************!*\
  728. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  729. \************************************************************/ /*! no static exports found */ /***/function node_modulesBabelRuntimeHelpersCreateClassJs(module,exports,__webpack_require__){var toPropertyKey=__webpack_require__(/*! ./toPropertyKey.js */"./node_modules/@babel/runtime/helpers/toPropertyKey.js");function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}module.exports=_createClass,module.exports.__esModule=true,module.exports["default"]=module.exports;/***/},/***/"./node_modules/@babel/runtime/helpers/toPrimitive.js":/*!************************************************************!*\
  730. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  731. \************************************************************/ /*! no static exports found */ /***/function node_modulesBabelRuntimeHelpersToPrimitiveJs(module,exports,__webpack_require__){var _typeof=__webpack_require__(/*! ./typeof.js */"./node_modules/@babel/runtime/helpers/typeof.js")["default"];function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}module.exports=_toPrimitive,module.exports.__esModule=true,module.exports["default"]=module.exports;/***/},/***/"./node_modules/@babel/runtime/helpers/toPropertyKey.js":/*!**************************************************************!*\
  732. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  733. \**************************************************************/ /*! no static exports found */ /***/function node_modulesBabelRuntimeHelpersToPropertyKeyJs(module,exports,__webpack_require__){var _typeof=__webpack_require__(/*! ./typeof.js */"./node_modules/@babel/runtime/helpers/typeof.js")["default"];var toPrimitive=__webpack_require__(/*! ./toPrimitive.js */"./node_modules/@babel/runtime/helpers/toPrimitive.js");function _toPropertyKey(arg){var key=toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}module.exports=_toPropertyKey,module.exports.__esModule=true,module.exports["default"]=module.exports;/***/},/***/"./node_modules/@babel/runtime/helpers/typeof.js":/*!*******************************************************!*\
  734. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  735. \*******************************************************/ /*! no static exports found */ /***/function node_modulesBabelRuntimeHelpersTypeofJs(module,exports){function _typeof(o){"@babel/helpers - typeof";return(module.exports=_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},module.exports.__esModule=true,module.exports["default"]=module.exports),_typeof(o);}module.exports=_typeof,module.exports.__esModule=true,module.exports["default"]=module.exports;/***/},/***/"./node_modules/@xmldom/xmldom/lib/conventions.js":/*!********************************************************!*\
  736. !*** ./node_modules/@xmldom/xmldom/lib/conventions.js ***!
  737. \********************************************************/ /*! no static exports found */ /***/function node_modulesXmldomXmldomLibConventionsJs(module,exports,__webpack_require__){/**
  738. * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
  739. *
  740. * Works with anything that has a `length` property and index access properties, including NodeList.
  741. *
  742. * @template {unknown} T
  743. * @param {Array<T> | ({length:number, [number]: T})} list
  744. * @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate
  745. * @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,
  746. * allows injecting a custom implementation in tests
  747. * @returns {T | undefined}
  748. *
  749. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
  750. * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
  751. */function find(list,predicate,ac){if(ac===undefined){ac=Array.prototype;}if(list&&typeof ac.find==='function'){return ac.find.call(list,predicate);}for(var i=0;i<list.length;i++){if(Object.prototype.hasOwnProperty.call(list,i)){var item=list[i];if(predicate.call(undefined,item,i,list)){return item;}}}}/**
  752. * "Shallow freezes" an object to render it immutable.
  753. * Uses `Object.freeze` if available,
  754. * otherwise the immutability is only in the type.
  755. *
  756. * Is used to create "enum like" objects.
  757. *
  758. * @template T
  759. * @param {T} object the object to freeze
  760. * @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
  761. * allows to inject custom object constructor for tests
  762. * @returns {Readonly<T>}
  763. *
  764. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
  765. */function freeze(object,oc){if(oc===undefined){oc=Object;}return oc&&typeof oc.freeze==='function'?oc.freeze(object):object;}/**
  766. * Since we can not rely on `Object.assign` we provide a simplified version
  767. * that is sufficient for our needs.
  768. *
  769. * @param {Object} target
  770. * @param {Object | null | undefined} source
  771. *
  772. * @returns {Object} target
  773. * @throws TypeError if target is not an object
  774. *
  775. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  776. * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
  777. */function assign(target,source){if(target===null||_typeof2(target)!=='object'){throw new TypeError('target is not an object');}for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}return target;}/**
  778. * All mime types that are allowed as input to `DOMParser.parseFromString`
  779. *
  780. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
  781. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
  782. * @see DOMParser.prototype.parseFromString
  783. */var MIME_TYPE=freeze({/**
  784. * `text/html`, the only mime type that triggers treating an XML document as HTML.
  785. *
  786. * @see DOMParser.SupportedType.isHTML
  787. * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
  788. * @see https://en.wikipedia.org/wiki/HTML Wikipedia
  789. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
  790. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
  791. */HTML:'text/html',/**
  792. * Helper method to check a mime type if it indicates an HTML document
  793. *
  794. * @param {string} [value]
  795. * @returns {boolean}
  796. *
  797. * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
  798. * @see https://en.wikipedia.org/wiki/HTML Wikipedia
  799. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
  800. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */isHTML:function isHTML(value){return value===MIME_TYPE.HTML;},/**
  801. * `application/xml`, the standard mime type for XML documents.
  802. *
  803. * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
  804. * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
  805. * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
  806. */XML_APPLICATION:'application/xml',/**
  807. * `text/html`, an alias for `application/xml`.
  808. *
  809. * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
  810. * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
  811. * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
  812. */XML_TEXT:'text/xml',/**
  813. * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
  814. * but is parsed as an XML document.
  815. *
  816. * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
  817. * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
  818. * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
  819. */XML_XHTML_APPLICATION:'application/xhtml+xml',/**
  820. * `image/svg+xml`,
  821. *
  822. * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
  823. * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
  824. * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
  825. */XML_SVG_IMAGE:'image/svg+xml'});/**
  826. * Namespaces that are used in this code base.
  827. *
  828. * @see http://www.w3.org/TR/REC-xml-names
  829. */var NAMESPACE=freeze({/**
  830. * The XHTML namespace.
  831. *
  832. * @see http://www.w3.org/1999/xhtml
  833. */HTML:'http://www.w3.org/1999/xhtml',/**
  834. * Checks if `uri` equals `NAMESPACE.HTML`.
  835. *
  836. * @param {string} [uri]
  837. *
  838. * @see NAMESPACE.HTML
  839. */isHTML:function isHTML(uri){return uri===NAMESPACE.HTML;},/**
  840. * The SVG namespace.
  841. *
  842. * @see http://www.w3.org/2000/svg
  843. */SVG:'http://www.w3.org/2000/svg',/**
  844. * The `xml:` namespace.
  845. *
  846. * @see http://www.w3.org/XML/1998/namespace
  847. */XML:'http://www.w3.org/XML/1998/namespace',/**
  848. * The `xmlns:` namespace
  849. *
  850. * @see https://www.w3.org/2000/xmlns/
  851. */XMLNS:'http://www.w3.org/2000/xmlns/'});exports.assign=assign;exports.find=find;exports.freeze=freeze;exports.MIME_TYPE=MIME_TYPE;exports.NAMESPACE=NAMESPACE;/***/},/***/"./node_modules/@xmldom/xmldom/lib/dom-parser.js":/*!*******************************************************!*\
  852. !*** ./node_modules/@xmldom/xmldom/lib/dom-parser.js ***!
  853. \*******************************************************/ /*! no static exports found */ /***/function node_modulesXmldomXmldomLibDomParserJs(module,exports,__webpack_require__){var conventions=__webpack_require__(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js");var dom=__webpack_require__(/*! ./dom */"./node_modules/@xmldom/xmldom/lib/dom.js");var entities=__webpack_require__(/*! ./entities */"./node_modules/@xmldom/xmldom/lib/entities.js");var sax=__webpack_require__(/*! ./sax */"./node_modules/@xmldom/xmldom/lib/sax.js");var DOMImplementation=dom.DOMImplementation;var NAMESPACE=conventions.NAMESPACE;var ParseError=sax.ParseError;var XMLReader=sax.XMLReader;/**
  854. * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:
  855. *
  856. * > XML parsed entities are often stored in computer files which,
  857. * > for editing convenience, are organized into lines.
  858. * > These lines are typically separated by some combination
  859. * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
  860. * >
  861. * > To simplify the tasks of applications, the XML processor must behave
  862. * > as if it normalized all line breaks in external parsed entities (including the document entity)
  863. * > on input, before parsing, by translating all of the following to a single #xA character:
  864. * >
  865. * > 1. the two-character sequence #xD #xA
  866. * > 2. the two-character sequence #xD #x85
  867. * > 3. the single character #x85
  868. * > 4. the single character #x2028
  869. * > 5. any #xD character that is not immediately followed by #xA or #x85.
  870. *
  871. * @param {string} input
  872. * @returns {string}
  873. */function normalizeLineEndings(input){return input.replace(/\r[\n\u0085]/g,'\n').replace(/[\r\u0085\u2028]/g,'\n');}/**
  874. * @typedef Locator
  875. * @property {number} [columnNumber]
  876. * @property {number} [lineNumber]
  877. */ /**
  878. * @typedef DOMParserOptions
  879. * @property {DOMHandler} [domBuilder]
  880. * @property {Function} [errorHandler]
  881. * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing
  882. * defaults to `normalizeLineEndings`
  883. * @property {Locator} [locator]
  884. * @property {Record<string, string>} [xmlns]
  885. *
  886. * @see normalizeLineEndings
  887. */ /**
  888. * The DOMParser interface provides the ability to parse XML or HTML source code
  889. * from a string into a DOM `Document`.
  890. *
  891. * _xmldom is different from the spec in that it allows an `options` parameter,
  892. * to override the default behavior._
  893. *
  894. * @param {DOMParserOptions} [options]
  895. * @constructor
  896. *
  897. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
  898. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
  899. */function DOMParser(options){this.options=options||{locator:{}};}DOMParser.prototype.parseFromString=function(source,mimeType){var options=this.options;var sax=new XMLReader();var domBuilder=options.domBuilder||new DOMHandler();//contentHandler and LexicalHandler
  900. var errorHandler=options.errorHandler;var locator=options.locator;var defaultNSMap=options.xmlns||{};var isHTML=/\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
  901. var entityMap=isHTML?entities.HTML_ENTITIES:entities.XML_ENTITIES;if(locator){domBuilder.setDocumentLocator(locator);}sax.errorHandler=buildErrorHandler(errorHandler,domBuilder,locator);sax.domBuilder=options.domBuilder||domBuilder;if(isHTML){defaultNSMap['']=NAMESPACE.HTML;}defaultNSMap.xml=defaultNSMap.xml||NAMESPACE.XML;var normalize=options.normalizeLineEndings||normalizeLineEndings;if(source&&typeof source==='string'){sax.parse(normalize(source),defaultNSMap,entityMap);}else{sax.errorHandler.error('invalid doc source');}return domBuilder.doc;};function buildErrorHandler(errorImpl,domBuilder,locator){if(!errorImpl){if(domBuilder instanceof DOMHandler){return domBuilder;}errorImpl=domBuilder;}var errorHandler={};var isCallback=errorImpl instanceof Function;locator=locator||{};function build(key){var fn=errorImpl[key];if(!fn&&isCallback){fn=errorImpl.length==2?function(msg){errorImpl(key,msg);}:errorImpl;}errorHandler[key]=fn&&function(msg){fn('[xmldom '+key+']\t'+msg+_locator(locator));}||function(){};}build('warning');build('error');build('fatalError');return errorHandler;}//console.log('#\n\n\n\n\n\n\n####')
  902. /**
  903. * +ContentHandler+ErrorHandler
  904. * +LexicalHandler+EntityResolver2
  905. * -DeclHandler-DTDHandler
  906. *
  907. * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
  908. * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
  909. * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
  910. */function DOMHandler(){this.cdata=false;}function position(locator,node){node.lineNumber=locator.lineNumber;node.columnNumber=locator.columnNumber;}/**
  911. * @see org.xml.sax.ContentHandler#startDocument
  912. * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
  913. */DOMHandler.prototype={startDocument:function startDocument(){this.doc=new DOMImplementation().createDocument(null,null,null);if(this.locator){this.doc.documentURI=this.locator.systemId;}},startElement:function startElement(namespaceURI,localName,qName,attrs){var doc=this.doc;var el=doc.createElementNS(namespaceURI,qName||localName);var len=attrs.length;appendElement(this,el);this.currentElement=el;this.locator&&position(this.locator,el);for(var i=0;i<len;i++){var namespaceURI=attrs.getURI(i);var value=attrs.getValue(i);var qName=attrs.getQName(i);var attr=doc.createAttributeNS(namespaceURI,qName);this.locator&&position(attrs.getLocator(i),attr);attr.value=attr.nodeValue=value;el.setAttributeNode(attr);}},endElement:function endElement(namespaceURI,localName,qName){var current=this.currentElement;current.tagName;this.currentElement=current.parentNode;},startPrefixMapping:function startPrefixMapping(prefix,uri){},endPrefixMapping:function endPrefixMapping(prefix){},processingInstruction:function processingInstruction(target,data){var ins=this.doc.createProcessingInstruction(target,data);this.locator&&position(this.locator,ins);appendElement(this,ins);},ignorableWhitespace:function ignorableWhitespace(ch,start,length){},characters:function characters(chars,start,length){chars=_toString.apply(this,arguments);//console.log(chars)
  914. if(chars){if(this.cdata){var charNode=this.doc.createCDATASection(chars);}else{var charNode=this.doc.createTextNode(chars);}if(this.currentElement){this.currentElement.appendChild(charNode);}else if(/^\s*$/.test(chars)){this.doc.appendChild(charNode);//process xml
  915. }this.locator&&position(this.locator,charNode);}},skippedEntity:function skippedEntity(name){},endDocument:function endDocument(){this.doc.normalize();},setDocumentLocator:function setDocumentLocator(locator){if(this.locator=locator){// && !('lineNumber' in locator)){
  916. locator.lineNumber=0;}},//LexicalHandler
  917. comment:function comment(chars,start,length){chars=_toString.apply(this,arguments);var comm=this.doc.createComment(chars);this.locator&&position(this.locator,comm);appendElement(this,comm);},startCDATA:function startCDATA(){//used in characters() methods
  918. this.cdata=true;},endCDATA:function endCDATA(){this.cdata=false;},startDTD:function startDTD(name,publicId,systemId){var impl=this.doc.implementation;if(impl&&impl.createDocumentType){var dt=impl.createDocumentType(name,publicId,systemId);this.locator&&position(this.locator,dt);appendElement(this,dt);this.doc.doctype=dt;}},/**
  919. * @see org.xml.sax.ErrorHandler
  920. * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
  921. */warning:function warning(error){console.warn('[xmldom warning]\t'+error,_locator(this.locator));},error:function error(_error){console.error('[xmldom error]\t'+_error,_locator(this.locator));},fatalError:function fatalError(error){throw new ParseError(error,this.locator);}};function _locator(l){if(l){return'\n@'+(l.systemId||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']';}}function _toString(chars,start,length){if(typeof chars=='string'){return chars.substr(start,length);}else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
  922. if(chars.length>=start+length||start){return new java.lang.String(chars,start,length)+'';}return chars;}}/*
  923. * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
  924. * used method of org.xml.sax.ext.LexicalHandler:
  925. * #comment(chars, start, length)
  926. * #startCDATA()
  927. * #endCDATA()
  928. * #startDTD(name, publicId, systemId)
  929. *
  930. *
  931. * IGNORED method of org.xml.sax.ext.LexicalHandler:
  932. * #endDTD()
  933. * #startEntity(name)
  934. * #endEntity(name)
  935. *
  936. *
  937. * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
  938. * IGNORED method of org.xml.sax.ext.DeclHandler
  939. * #attributeDecl(eName, aName, type, mode, value)
  940. * #elementDecl(name, model)
  941. * #externalEntityDecl(name, publicId, systemId)
  942. * #internalEntityDecl(name, value)
  943. * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
  944. * IGNORED method of org.xml.sax.EntityResolver2
  945. * #resolveEntity(String name,String publicId,String baseURI,String systemId)
  946. * #resolveEntity(publicId, systemId)
  947. * #getExternalSubset(name, baseURI)
  948. * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
  949. * IGNORED method of org.xml.sax.DTDHandler
  950. * #notationDecl(name, publicId, systemId) {};
  951. * #unparsedEntityDecl(name, publicId, systemId, notationName) {};
  952. */"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){DOMHandler.prototype[key]=function(){return null;};});/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */function appendElement(hander,node){if(!hander.currentElement){hander.doc.appendChild(node);}else{hander.currentElement.appendChild(node);}}//appendChild and setAttributeNS are preformance key
  953. exports.__DOMHandler=DOMHandler;exports.normalizeLineEndings=normalizeLineEndings;exports.DOMParser=DOMParser;/***/},/***/"./node_modules/@xmldom/xmldom/lib/dom.js":/*!************************************************!*\
  954. !*** ./node_modules/@xmldom/xmldom/lib/dom.js ***!
  955. \************************************************/ /*! no static exports found */ /***/function node_modulesXmldomXmldomLibDomJs(module,exports,__webpack_require__){var conventions=__webpack_require__(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js");var find=conventions.find;var NAMESPACE=conventions.NAMESPACE;/**
  956. * A prerequisite for `[].filter`, to drop elements that are empty
  957. * @param {string} input
  958. * @returns {boolean}
  959. */function notEmptyString(input){return input!=='';}/**
  960. * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace
  961. * @see https://infra.spec.whatwg.org/#ascii-whitespace
  962. *
  963. * @param {string} input
  964. * @returns {string[]} (can be empty)
  965. */function splitOnASCIIWhitespace(input){// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE
  966. return input?input.split(/[\t\n\f\r ]+/).filter(notEmptyString):[];}/**
  967. * Adds element as a key to current if it is not already present.
  968. *
  969. * @param {Record<string, boolean | undefined>} current
  970. * @param {string} element
  971. * @returns {Record<string, boolean | undefined>}
  972. */function orderedSetReducer(current,element){if(!current.hasOwnProperty(element)){current[element]=true;}return current;}/**
  973. * @see https://infra.spec.whatwg.org/#ordered-set
  974. * @param {string} input
  975. * @returns {string[]}
  976. */function toOrderedSet(input){if(!input)return[];var list=splitOnASCIIWhitespace(input);return Object.keys(list.reduce(orderedSetReducer,{}));}/**
  977. * Uses `list.indexOf` to implement something like `Array.prototype.includes`,
  978. * which we can not rely on being available.
  979. *
  980. * @param {any[]} list
  981. * @returns {function(any): boolean}
  982. */function arrayIncludes(list){return function(element){return list&&list.indexOf(element)!==-1;};}function copy(src,dest){for(var p in src){if(Object.prototype.hasOwnProperty.call(src,p)){dest[p]=src[p];}}}/**
  983. ^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
  984. ^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));?
  985. */function _extends(Class,Super){var pt=Class.prototype;if(!(pt instanceof Super)){function t(){}t.prototype=Super.prototype;t=new t();copy(pt,t);Class.prototype=pt=t;}if(pt.constructor!=Class){if(typeof Class!='function'){console.error("unknown Class:"+Class);}pt.constructor=Class;}}// Node Types
  986. var NodeType={};var ELEMENT_NODE=NodeType.ELEMENT_NODE=1;var ATTRIBUTE_NODE=NodeType.ATTRIBUTE_NODE=2;var TEXT_NODE=NodeType.TEXT_NODE=3;var CDATA_SECTION_NODE=NodeType.CDATA_SECTION_NODE=4;var ENTITY_REFERENCE_NODE=NodeType.ENTITY_REFERENCE_NODE=5;var ENTITY_NODE=NodeType.ENTITY_NODE=6;var PROCESSING_INSTRUCTION_NODE=NodeType.PROCESSING_INSTRUCTION_NODE=7;var COMMENT_NODE=NodeType.COMMENT_NODE=8;var DOCUMENT_NODE=NodeType.DOCUMENT_NODE=9;var DOCUMENT_TYPE_NODE=NodeType.DOCUMENT_TYPE_NODE=10;var DOCUMENT_FRAGMENT_NODE=NodeType.DOCUMENT_FRAGMENT_NODE=11;var NOTATION_NODE=NodeType.NOTATION_NODE=12;// ExceptionCode
  987. var ExceptionCode={};var ExceptionMessage={};ExceptionCode.INDEX_SIZE_ERR=(ExceptionMessage[1]="Index size error",1);ExceptionCode.DOMSTRING_SIZE_ERR=(ExceptionMessage[2]="DOMString size error",2);var HIERARCHY_REQUEST_ERR=ExceptionCode.HIERARCHY_REQUEST_ERR=(ExceptionMessage[3]="Hierarchy request error",3);ExceptionCode.WRONG_DOCUMENT_ERR=(ExceptionMessage[4]="Wrong document",4);ExceptionCode.INVALID_CHARACTER_ERR=(ExceptionMessage[5]="Invalid character",5);ExceptionCode.NO_DATA_ALLOWED_ERR=(ExceptionMessage[6]="No data allowed",6);ExceptionCode.NO_MODIFICATION_ALLOWED_ERR=(ExceptionMessage[7]="No modification allowed",7);var NOT_FOUND_ERR=ExceptionCode.NOT_FOUND_ERR=(ExceptionMessage[8]="Not found",8);ExceptionCode.NOT_SUPPORTED_ERR=(ExceptionMessage[9]="Not supported",9);var INUSE_ATTRIBUTE_ERR=ExceptionCode.INUSE_ATTRIBUTE_ERR=(ExceptionMessage[10]="Attribute in use",10);//level2
  988. ExceptionCode.INVALID_STATE_ERR=(ExceptionMessage[11]="Invalid state",11);ExceptionCode.SYNTAX_ERR=(ExceptionMessage[12]="Syntax error",12);ExceptionCode.INVALID_MODIFICATION_ERR=(ExceptionMessage[13]="Invalid modification",13);ExceptionCode.NAMESPACE_ERR=(ExceptionMessage[14]="Invalid namespace",14);ExceptionCode.INVALID_ACCESS_ERR=(ExceptionMessage[15]="Invalid access",15);/**
  989. * DOM Level 2
  990. * Object DOMException
  991. * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
  992. * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
  993. */function DOMException(code,message){if(message instanceof Error){var error=message;}else{error=this;Error.call(this,ExceptionMessage[code]);this.message=ExceptionMessage[code];if(Error.captureStackTrace)Error.captureStackTrace(this,DOMException);}error.code=code;if(message)this.message=this.message+": "+message;return error;}DOMException.prototype=Error.prototype;copy(ExceptionCode,DOMException);/**
  994. * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
  995. * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
  996. * The items in the NodeList are accessible via an integral index, starting from 0.
  997. */function NodeList(){}NodeList.prototype={/**
  998. * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
  999. * @standard level1
  1000. */length:0,/**
  1001. * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
  1002. * @standard level1
  1003. * @param index unsigned long
  1004. * Index into the collection.
  1005. * @return Node
  1006. * The node at the indexth position in the NodeList, or null if that is not a valid index.
  1007. */item:function item(index){return index>=0&&index<this.length?this[index]:null;},toString:function toString(isHTML,nodeFilter){for(var buf=[],i=0;i<this.length;i++){serializeToString(this[i],buf,isHTML,nodeFilter);}return buf.join('');},/**
  1008. * @private
  1009. * @param {function (Node):boolean} predicate
  1010. * @returns {Node[]}
  1011. */filter:function filter(predicate){return Array.prototype.filter.call(this,predicate);},/**
  1012. * @private
  1013. * @param {Node} item
  1014. * @returns {number}
  1015. */indexOf:function indexOf(item){return Array.prototype.indexOf.call(this,item);}};function LiveNodeList(node,refresh){this._node=node;this._refresh=refresh;_updateLiveList(this);}function _updateLiveList(list){var inc=list._node._inc||list._node.ownerDocument._inc;if(list._inc!==inc){var ls=list._refresh(list._node);__set__(list,'length',ls.length);if(!list.$$length||ls.length<list.$$length){for(var i=ls.length;(i in list);i++){if(Object.prototype.hasOwnProperty.call(list,i)){delete list[i];}}}copy(ls,list);list._inc=inc;}}LiveNodeList.prototype.item=function(i){_updateLiveList(this);return this[i]||null;};_extends(LiveNodeList,NodeList);/**
  1016. * Objects implementing the NamedNodeMap interface are used
  1017. * to represent collections of nodes that can be accessed by name.
  1018. * Note that NamedNodeMap does not inherit from NodeList;
  1019. * NamedNodeMaps are not maintained in any particular order.
  1020. * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,
  1021. * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
  1022. * and does not imply that the DOM specifies an order to these Nodes.
  1023. * NamedNodeMap objects in the DOM are live.
  1024. * used for attributes or DocumentType entities
  1025. */function NamedNodeMap(){}function _findNodeIndex(list,node){var i=list.length;while(i--){if(list[i]===node){return i;}}}function _addNamedNode(el,list,newAttr,oldAttr){if(oldAttr){list[_findNodeIndex(list,oldAttr)]=newAttr;}else{list[list.length++]=newAttr;}if(el){newAttr.ownerElement=el;var doc=el.ownerDocument;if(doc){oldAttr&&_onRemoveAttribute(doc,el,oldAttr);_onAddAttribute(doc,el,newAttr);}}}function _removeNamedNode(el,list,attr){//console.log('remove attr:'+attr)
  1026. var i=_findNodeIndex(list,attr);if(i>=0){var lastIndex=list.length-1;while(i<lastIndex){list[i]=list[++i];}list.length=lastIndex;if(el){var doc=el.ownerDocument;if(doc){_onRemoveAttribute(doc,el,attr);attr.ownerElement=null;}}}else{throw new DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr));}}NamedNodeMap.prototype={length:0,item:NodeList.prototype.item,getNamedItem:function getNamedItem(key){// if(key.indexOf(':')>0 || key == 'xmlns'){
  1027. // return null;
  1028. // }
  1029. //console.log()
  1030. var i=this.length;while(i--){var attr=this[i];//console.log(attr.nodeName,key)
  1031. if(attr.nodeName==key){return attr;}}},setNamedItem:function setNamedItem(attr){var el=attr.ownerElement;if(el&&el!=this._ownerElement){throw new DOMException(INUSE_ATTRIBUTE_ERR);}var oldAttr=this.getNamedItem(attr.nodeName);_addNamedNode(this._ownerElement,this,attr,oldAttr);return oldAttr;},/* returns Node */setNamedItemNS:function setNamedItemNS(attr){// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR
  1032. var el=attr.ownerElement,oldAttr;if(el&&el!=this._ownerElement){throw new DOMException(INUSE_ATTRIBUTE_ERR);}oldAttr=this.getNamedItemNS(attr.namespaceURI,attr.localName);_addNamedNode(this._ownerElement,this,attr,oldAttr);return oldAttr;},/* returns Node */removeNamedItem:function removeNamedItem(key){var attr=this.getNamedItem(key);_removeNamedNode(this._ownerElement,this,attr);return attr;},// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
  1033. //for level2
  1034. removeNamedItemNS:function removeNamedItemNS(namespaceURI,localName){var attr=this.getNamedItemNS(namespaceURI,localName);_removeNamedNode(this._ownerElement,this,attr);return attr;},getNamedItemNS:function getNamedItemNS(namespaceURI,localName){var i=this.length;while(i--){var node=this[i];if(node.localName==localName&&node.namespaceURI==namespaceURI){return node;}}return null;}};/**
  1035. * The DOMImplementation interface represents an object providing methods
  1036. * which are not dependent on any particular document.
  1037. * Such an object is returned by the `Document.implementation` property.
  1038. *
  1039. * __The individual methods describe the differences compared to the specs.__
  1040. *
  1041. * @constructor
  1042. *
  1043. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
  1044. * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)
  1045. * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
  1046. * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
  1047. * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
  1048. */function DOMImplementation(){}DOMImplementation.prototype={/**
  1049. * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
  1050. * The different implementations fairly diverged in what kind of features were reported.
  1051. * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
  1052. *
  1053. * @deprecated It is deprecated and modern browsers return true in all cases.
  1054. *
  1055. * @param {string} feature
  1056. * @param {string} [version]
  1057. * @returns {boolean} always true
  1058. *
  1059. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
  1060. * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
  1061. * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
  1062. */hasFeature:function hasFeature(feature,version){return true;},/**
  1063. * Creates an XML Document object of the specified type with its document element.
  1064. *
  1065. * __It behaves slightly different from the description in the living standard__:
  1066. * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
  1067. * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
  1068. * - this implementation is not validating names or qualified names
  1069. * (when parsing XML strings, the SAX parser takes care of that)
  1070. *
  1071. * @param {string|null} namespaceURI
  1072. * @param {string} qualifiedName
  1073. * @param {DocumentType=null} doctype
  1074. * @returns {Document}
  1075. *
  1076. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
  1077. * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
  1078. * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
  1079. *
  1080. * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
  1081. * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
  1082. * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
  1083. */createDocument:function createDocument(namespaceURI,qualifiedName,doctype){var doc=new Document();doc.implementation=this;doc.childNodes=new NodeList();doc.doctype=doctype||null;if(doctype){doc.appendChild(doctype);}if(qualifiedName){var root=doc.createElementNS(namespaceURI,qualifiedName);doc.appendChild(root);}return doc;},/**
  1084. * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
  1085. *
  1086. * __This behavior is slightly different from the in the specs__:
  1087. * - this implementation is not validating names or qualified names
  1088. * (when parsing XML strings, the SAX parser takes care of that)
  1089. *
  1090. * @param {string} qualifiedName
  1091. * @param {string} [publicId]
  1092. * @param {string} [systemId]
  1093. * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
  1094. * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
  1095. *
  1096. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
  1097. * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
  1098. * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
  1099. *
  1100. * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
  1101. * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
  1102. * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
  1103. */createDocumentType:function createDocumentType(qualifiedName,publicId,systemId){var node=new DocumentType();node.name=qualifiedName;node.nodeName=qualifiedName;node.publicId=publicId||'';node.systemId=systemId||'';return node;}};/**
  1104. * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
  1105. */function Node(){}Node.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,// Modified in DOM Level 2:
  1106. insertBefore:function insertBefore(newChild,refChild){//raises
  1107. return _insertBefore(this,newChild,refChild);},replaceChild:function replaceChild(newChild,oldChild){//raises
  1108. _insertBefore(this,newChild,oldChild,assertPreReplacementValidityInDocument);if(oldChild){this.removeChild(oldChild);}},removeChild:function removeChild(oldChild){return _removeChild(this,oldChild);},appendChild:function appendChild(newChild){return this.insertBefore(newChild,null);},hasChildNodes:function hasChildNodes(){return this.firstChild!=null;},cloneNode:function cloneNode(deep){return _cloneNode(this.ownerDocument||this,this,deep);},// Modified in DOM Level 2:
  1109. normalize:function normalize(){var child=this.firstChild;while(child){var next=child.nextSibling;if(next&&next.nodeType==TEXT_NODE&&child.nodeType==TEXT_NODE){this.removeChild(next);child.appendData(next.data);}else{child.normalize();child=next;}}},// Introduced in DOM Level 2:
  1110. isSupported:function isSupported(feature,version){return this.ownerDocument.implementation.hasFeature(feature,version);},// Introduced in DOM Level 2:
  1111. hasAttributes:function hasAttributes(){return this.attributes.length>0;},/**
  1112. * Look up the prefix associated to the given namespace URI, starting from this node.
  1113. * **The default namespace declarations are ignored by this method.**
  1114. * See Namespace Prefix Lookup for details on the algorithm used by this method.
  1115. *
  1116. * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
  1117. *
  1118. * @param {string | null} namespaceURI
  1119. * @returns {string | null}
  1120. * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
  1121. * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
  1122. * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
  1123. * @see https://github.com/xmldom/xmldom/issues/322
  1124. */lookupPrefix:function lookupPrefix(namespaceURI){var el=this;while(el){var map=el._nsMap;//console.dir(map)
  1125. if(map){for(var n in map){if(Object.prototype.hasOwnProperty.call(map,n)&&map[n]===namespaceURI){return n;}}}el=el.nodeType==ATTRIBUTE_NODE?el.ownerDocument:el.parentNode;}return null;},// Introduced in DOM Level 3:
  1126. lookupNamespaceURI:function lookupNamespaceURI(prefix){var el=this;while(el){var map=el._nsMap;//console.dir(map)
  1127. if(map){if(Object.prototype.hasOwnProperty.call(map,prefix)){return map[prefix];}}el=el.nodeType==ATTRIBUTE_NODE?el.ownerDocument:el.parentNode;}return null;},// Introduced in DOM Level 3:
  1128. isDefaultNamespace:function isDefaultNamespace(namespaceURI){var prefix=this.lookupPrefix(namespaceURI);return prefix==null;}};function _xmlEncoder(c){return c=='<'&&'&lt;'||c=='>'&&'&gt;'||c=='&'&&'&amp;'||c=='"'&&'&quot;'||'&#'+c.charCodeAt()+';';}copy(NodeType,Node);copy(NodeType,Node.prototype);/**
  1129. * @param callback return true for continue,false for break
  1130. * @return boolean true: break visit;
  1131. */function _visitNode(node,callback){if(callback(node)){return true;}if(node=node.firstChild){do{if(_visitNode(node,callback)){return true;}}while(node=node.nextSibling);}}function Document(){this.ownerDocument=this;}function _onAddAttribute(doc,el,newAttr){doc&&doc._inc++;var ns=newAttr.namespaceURI;if(ns===NAMESPACE.XMLNS){//update namespace
  1132. el._nsMap[newAttr.prefix?newAttr.localName:'']=newAttr.value;}}function _onRemoveAttribute(doc,el,newAttr,remove){doc&&doc._inc++;var ns=newAttr.namespaceURI;if(ns===NAMESPACE.XMLNS){//update namespace
  1133. delete el._nsMap[newAttr.prefix?newAttr.localName:''];}}/**
  1134. * Updates `el.childNodes`, updating the indexed items and it's `length`.
  1135. * Passing `newChild` means it will be appended.
  1136. * Otherwise it's assumed that an item has been removed,
  1137. * and `el.firstNode` and it's `.nextSibling` are used
  1138. * to walk the current list of child nodes.
  1139. *
  1140. * @param {Document} doc
  1141. * @param {Node} el
  1142. * @param {Node} [newChild]
  1143. * @private
  1144. */function _onUpdateChild(doc,el,newChild){if(doc&&doc._inc){doc._inc++;//update childNodes
  1145. var cs=el.childNodes;if(newChild){cs[cs.length++]=newChild;}else{var child=el.firstChild;var i=0;while(child){cs[i++]=child;child=child.nextSibling;}cs.length=i;delete cs[cs.length];}}}/**
  1146. * Removes the connections between `parentNode` and `child`
  1147. * and any existing `child.previousSibling` or `child.nextSibling`.
  1148. *
  1149. * @see https://github.com/xmldom/xmldom/issues/135
  1150. * @see https://github.com/xmldom/xmldom/issues/145
  1151. *
  1152. * @param {Node} parentNode
  1153. * @param {Node} child
  1154. * @returns {Node} the child that was removed.
  1155. * @private
  1156. */function _removeChild(parentNode,child){var previous=child.previousSibling;var next=child.nextSibling;if(previous){previous.nextSibling=next;}else{parentNode.firstChild=next;}if(next){next.previousSibling=previous;}else{parentNode.lastChild=previous;}child.parentNode=null;child.previousSibling=null;child.nextSibling=null;_onUpdateChild(parentNode.ownerDocument,parentNode);return child;}/**
  1157. * Returns `true` if `node` can be a parent for insertion.
  1158. * @param {Node} node
  1159. * @returns {boolean}
  1160. */function hasValidParentNodeType(node){return node&&(node.nodeType===Node.DOCUMENT_NODE||node.nodeType===Node.DOCUMENT_FRAGMENT_NODE||node.nodeType===Node.ELEMENT_NODE);}/**
  1161. * Returns `true` if `node` can be inserted according to it's `nodeType`.
  1162. * @param {Node} node
  1163. * @returns {boolean}
  1164. */function hasInsertableNodeType(node){return node&&(isElementNode(node)||isTextNode(node)||isDocTypeNode(node)||node.nodeType===Node.DOCUMENT_FRAGMENT_NODE||node.nodeType===Node.COMMENT_NODE||node.nodeType===Node.PROCESSING_INSTRUCTION_NODE);}/**
  1165. * Returns true if `node` is a DOCTYPE node
  1166. * @param {Node} node
  1167. * @returns {boolean}
  1168. */function isDocTypeNode(node){return node&&node.nodeType===Node.DOCUMENT_TYPE_NODE;}/**
  1169. * Returns true if the node is an element
  1170. * @param {Node} node
  1171. * @returns {boolean}
  1172. */function isElementNode(node){return node&&node.nodeType===Node.ELEMENT_NODE;}/**
  1173. * Returns true if `node` is a text node
  1174. * @param {Node} node
  1175. * @returns {boolean}
  1176. */function isTextNode(node){return node&&node.nodeType===Node.TEXT_NODE;}/**
  1177. * Check if en element node can be inserted before `child`, or at the end if child is falsy,
  1178. * according to the presence and position of a doctype node on the same level.
  1179. *
  1180. * @param {Document} doc The document node
  1181. * @param {Node} child the node that would become the nextSibling if the element would be inserted
  1182. * @returns {boolean} `true` if an element can be inserted before child
  1183. * @private
  1184. * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  1185. */function isElementInsertionPossible(doc,child){var parentChildNodes=doc.childNodes||[];if(find(parentChildNodes,isElementNode)||isDocTypeNode(child)){return false;}var docTypeNode=find(parentChildNodes,isDocTypeNode);return!(child&&docTypeNode&&parentChildNodes.indexOf(docTypeNode)>parentChildNodes.indexOf(child));}/**
  1186. * Check if en element node can be inserted before `child`, or at the end if child is falsy,
  1187. * according to the presence and position of a doctype node on the same level.
  1188. *
  1189. * @param {Node} doc The document node
  1190. * @param {Node} child the node that would become the nextSibling if the element would be inserted
  1191. * @returns {boolean} `true` if an element can be inserted before child
  1192. * @private
  1193. * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  1194. */function isElementReplacementPossible(doc,child){var parentChildNodes=doc.childNodes||[];function hasElementChildThatIsNotChild(node){return isElementNode(node)&&node!==child;}if(find(parentChildNodes,hasElementChildThatIsNotChild)){return false;}var docTypeNode=find(parentChildNodes,isDocTypeNode);return!(child&&docTypeNode&&parentChildNodes.indexOf(docTypeNode)>parentChildNodes.indexOf(child));}/**
  1195. * @private
  1196. * Steps 1-5 of the checks before inserting and before replacing a child are the same.
  1197. *
  1198. * @param {Node} parent the parent node to insert `node` into
  1199. * @param {Node} node the node to insert
  1200. * @param {Node=} child the node that should become the `nextSibling` of `node`
  1201. * @returns {Node}
  1202. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  1203. * @throws DOMException if `child` is provided but is not a child of `parent`.
  1204. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  1205. * @see https://dom.spec.whatwg.org/#concept-node-replace
  1206. */function assertPreInsertionValidity1to5(parent,node,child){// 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a "HierarchyRequestError" DOMException.
  1207. if(!hasValidParentNodeType(parent)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Unexpected parent node type '+parent.nodeType);}// 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a "HierarchyRequestError" DOMException.
  1208. // not implemented!
  1209. // 3. If `child` is non-null and its parent is not `parent`, then throw a "NotFoundError" DOMException.
  1210. if(child&&child.parentNode!==parent){throw new DOMException(NOT_FOUND_ERR,'child not in parent');}if(// 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException.
  1211. !hasInsertableNodeType(node)||// 5. If either `node` is a Text node and `parent` is a document,
  1212. // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
  1213. // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
  1214. // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
  1215. isDocTypeNode(node)&&parent.nodeType!==Node.DOCUMENT_NODE){throw new DOMException(HIERARCHY_REQUEST_ERR,'Unexpected node type '+node.nodeType+' for parent node type '+parent.nodeType);}}/**
  1216. * @private
  1217. * Step 6 of the checks before inserting and before replacing a child are different.
  1218. *
  1219. * @param {Document} parent the parent node to insert `node` into
  1220. * @param {Node} node the node to insert
  1221. * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
  1222. * @returns {Node}
  1223. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  1224. * @throws DOMException if `child` is provided but is not a child of `parent`.
  1225. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  1226. * @see https://dom.spec.whatwg.org/#concept-node-replace
  1227. */function assertPreInsertionValidityInDocument(parent,node,child){var parentChildNodes=parent.childNodes||[];var nodeChildNodes=node.childNodes||[];// DocumentFragment
  1228. if(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var nodeChildElements=nodeChildNodes.filter(isElementNode);// If node has more than one element child or has a Text node child.
  1229. if(nodeChildElements.length>1||find(nodeChildNodes,isTextNode)){throw new DOMException(HIERARCHY_REQUEST_ERR,'More than one element or text in fragment');}// Otherwise, if `node` has one element child and either `parent` has an element child,
  1230. // `child` is a doctype, or `child` is non-null and a doctype is following `child`.
  1231. if(nodeChildElements.length===1&&!isElementInsertionPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Element in fragment can not be inserted before doctype');}}// Element
  1232. if(isElementNode(node)){// `parent` has an element child, `child` is a doctype,
  1233. // or `child` is non-null and a doctype is following `child`.
  1234. if(!isElementInsertionPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Only one element can be added and only after doctype');}}// DocumentType
  1235. if(isDocTypeNode(node)){// `parent` has a doctype child,
  1236. if(find(parentChildNodes,isDocTypeNode)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Only one doctype is allowed');}var parentElementChild=find(parentChildNodes,isElementNode);// `child` is non-null and an element is preceding `child`,
  1237. if(child&&parentChildNodes.indexOf(parentElementChild)<parentChildNodes.indexOf(child)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Doctype can only be inserted before an element');}// or `child` is null and `parent` has an element child.
  1238. if(!child&&parentElementChild){throw new DOMException(HIERARCHY_REQUEST_ERR,'Doctype can not be appended since element is present');}}}/**
  1239. * @private
  1240. * Step 6 of the checks before inserting and before replacing a child are different.
  1241. *
  1242. * @param {Document} parent the parent node to insert `node` into
  1243. * @param {Node} node the node to insert
  1244. * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
  1245. * @returns {Node}
  1246. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  1247. * @throws DOMException if `child` is provided but is not a child of `parent`.
  1248. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  1249. * @see https://dom.spec.whatwg.org/#concept-node-replace
  1250. */function assertPreReplacementValidityInDocument(parent,node,child){var parentChildNodes=parent.childNodes||[];var nodeChildNodes=node.childNodes||[];// DocumentFragment
  1251. if(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var nodeChildElements=nodeChildNodes.filter(isElementNode);// If `node` has more than one element child or has a Text node child.
  1252. if(nodeChildElements.length>1||find(nodeChildNodes,isTextNode)){throw new DOMException(HIERARCHY_REQUEST_ERR,'More than one element or text in fragment');}// Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.
  1253. if(nodeChildElements.length===1&&!isElementReplacementPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Element in fragment can not be inserted before doctype');}}// Element
  1254. if(isElementNode(node)){// `parent` has an element child that is not `child` or a doctype is following `child`.
  1255. if(!isElementReplacementPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Only one element can be added and only after doctype');}}// DocumentType
  1256. if(isDocTypeNode(node)){function hasDoctypeChildThatIsNotChild(node){return isDocTypeNode(node)&&node!==child;}// `parent` has a doctype child that is not `child`,
  1257. if(find(parentChildNodes,hasDoctypeChildThatIsNotChild)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Only one doctype is allowed');}var parentElementChild=find(parentChildNodes,isElementNode);// or an element is preceding `child`.
  1258. if(child&&parentChildNodes.indexOf(parentElementChild)<parentChildNodes.indexOf(child)){throw new DOMException(HIERARCHY_REQUEST_ERR,'Doctype can only be inserted before an element');}}}/**
  1259. * @private
  1260. * @param {Node} parent the parent node to insert `node` into
  1261. * @param {Node} node the node to insert
  1262. * @param {Node=} child the node that should become the `nextSibling` of `node`
  1263. * @returns {Node}
  1264. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  1265. * @throws DOMException if `child` is provided but is not a child of `parent`.
  1266. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  1267. */function _insertBefore(parent,node,child,_inDocumentAssertion){// To ensure pre-insertion validity of a node into a parent before a child, run these steps:
  1268. assertPreInsertionValidity1to5(parent,node,child);// If parent is a document, and any of the statements below, switched on the interface node implements,
  1269. // are true, then throw a "HierarchyRequestError" DOMException.
  1270. if(parent.nodeType===Node.DOCUMENT_NODE){(_inDocumentAssertion||assertPreInsertionValidityInDocument)(parent,node,child);}var cp=node.parentNode;if(cp){cp.removeChild(node);//remove and update
  1271. }if(node.nodeType===DOCUMENT_FRAGMENT_NODE){var newFirst=node.firstChild;if(newFirst==null){return node;}var newLast=node.lastChild;}else{newFirst=newLast=node;}var pre=child?child.previousSibling:parent.lastChild;newFirst.previousSibling=pre;newLast.nextSibling=child;if(pre){pre.nextSibling=newFirst;}else{parent.firstChild=newFirst;}if(child==null){parent.lastChild=newLast;}else{child.previousSibling=newLast;}do{newFirst.parentNode=parent;}while(newFirst!==newLast&&(newFirst=newFirst.nextSibling));_onUpdateChild(parent.ownerDocument||parent,parent);//console.log(parent.lastChild.nextSibling == null)
  1272. if(node.nodeType==DOCUMENT_FRAGMENT_NODE){node.firstChild=node.lastChild=null;}return node;}/**
  1273. * Appends `newChild` to `parentNode`.
  1274. * If `newChild` is already connected to a `parentNode` it is first removed from it.
  1275. *
  1276. * @see https://github.com/xmldom/xmldom/issues/135
  1277. * @see https://github.com/xmldom/xmldom/issues/145
  1278. * @param {Node} parentNode
  1279. * @param {Node} newChild
  1280. * @returns {Node}
  1281. * @private
  1282. */function _appendSingleChild(parentNode,newChild){if(newChild.parentNode){newChild.parentNode.removeChild(newChild);}newChild.parentNode=parentNode;newChild.previousSibling=parentNode.lastChild;newChild.nextSibling=null;if(newChild.previousSibling){newChild.previousSibling.nextSibling=newChild;}else{parentNode.firstChild=newChild;}parentNode.lastChild=newChild;_onUpdateChild(parentNode.ownerDocument,parentNode,newChild);return newChild;}Document.prototype={//implementation : null,
  1283. nodeName:'#document',nodeType:DOCUMENT_NODE,/**
  1284. * The DocumentType node of the document.
  1285. *
  1286. * @readonly
  1287. * @type DocumentType
  1288. */doctype:null,documentElement:null,_inc:1,insertBefore:function insertBefore(newChild,refChild){//raises
  1289. if(newChild.nodeType==DOCUMENT_FRAGMENT_NODE){var child=newChild.firstChild;while(child){var next=child.nextSibling;this.insertBefore(child,refChild);child=next;}return newChild;}_insertBefore(this,newChild,refChild);newChild.ownerDocument=this;if(this.documentElement===null&&newChild.nodeType===ELEMENT_NODE){this.documentElement=newChild;}return newChild;},removeChild:function removeChild(oldChild){if(this.documentElement==oldChild){this.documentElement=null;}return _removeChild(this,oldChild);},replaceChild:function replaceChild(newChild,oldChild){//raises
  1290. _insertBefore(this,newChild,oldChild,assertPreReplacementValidityInDocument);newChild.ownerDocument=this;if(oldChild){this.removeChild(oldChild);}if(isElementNode(newChild)){this.documentElement=newChild;}},// Introduced in DOM Level 2:
  1291. importNode:function importNode(importedNode,deep){return _importNode(this,importedNode,deep);},// Introduced in DOM Level 2:
  1292. getElementById:function getElementById(id){var rtv=null;_visitNode(this.documentElement,function(node){if(node.nodeType==ELEMENT_NODE){if(node.getAttribute('id')==id){rtv=node;return true;}}});return rtv;},/**
  1293. * The `getElementsByClassName` method of `Document` interface returns an array-like object
  1294. * of all child elements which have **all** of the given class name(s).
  1295. *
  1296. * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
  1297. *
  1298. *
  1299. * Warning: This is a live LiveNodeList.
  1300. * Changes in the DOM will reflect in the array as the changes occur.
  1301. * If an element selected by this array no longer qualifies for the selector,
  1302. * it will automatically be removed. Be aware of this for iteration purposes.
  1303. *
  1304. * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
  1305. *
  1306. * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
  1307. * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
  1308. */getElementsByClassName:function getElementsByClassName(classNames){var classNamesSet=toOrderedSet(classNames);return new LiveNodeList(this,function(base){var ls=[];if(classNamesSet.length>0){_visitNode(base.documentElement,function(node){if(node!==base&&node.nodeType===ELEMENT_NODE){var nodeClassNames=node.getAttribute('class');// can be null if the attribute does not exist
  1309. if(nodeClassNames){// before splitting and iterating just compare them for the most common case
  1310. var matches=classNames===nodeClassNames;if(!matches){var nodeClassNamesSet=toOrderedSet(nodeClassNames);matches=classNamesSet.every(arrayIncludes(nodeClassNamesSet));}if(matches){ls.push(node);}}}});}return ls;});},//document factory method:
  1311. createElement:function createElement(tagName){var node=new Element();node.ownerDocument=this;node.nodeName=tagName;node.tagName=tagName;node.localName=tagName;node.childNodes=new NodeList();var attrs=node.attributes=new NamedNodeMap();attrs._ownerElement=node;return node;},createDocumentFragment:function createDocumentFragment(){var node=new DocumentFragment();node.ownerDocument=this;node.childNodes=new NodeList();return node;},createTextNode:function createTextNode(data){var node=new Text();node.ownerDocument=this;node.appendData(data);return node;},createComment:function createComment(data){var node=new Comment();node.ownerDocument=this;node.appendData(data);return node;},createCDATASection:function createCDATASection(data){var node=new CDATASection();node.ownerDocument=this;node.appendData(data);return node;},createProcessingInstruction:function createProcessingInstruction(target,data){var node=new ProcessingInstruction();node.ownerDocument=this;node.tagName=node.nodeName=node.target=target;node.nodeValue=node.data=data;return node;},createAttribute:function createAttribute(name){var node=new Attr();node.ownerDocument=this;node.name=name;node.nodeName=name;node.localName=name;node.specified=true;return node;},createEntityReference:function createEntityReference(name){var node=new EntityReference();node.ownerDocument=this;node.nodeName=name;return node;},// Introduced in DOM Level 2:
  1312. createElementNS:function createElementNS(namespaceURI,qualifiedName){var node=new Element();var pl=qualifiedName.split(':');var attrs=node.attributes=new NamedNodeMap();node.childNodes=new NodeList();node.ownerDocument=this;node.nodeName=qualifiedName;node.tagName=qualifiedName;node.namespaceURI=namespaceURI;if(pl.length==2){node.prefix=pl[0];node.localName=pl[1];}else{//el.prefix = null;
  1313. node.localName=qualifiedName;}attrs._ownerElement=node;return node;},// Introduced in DOM Level 2:
  1314. createAttributeNS:function createAttributeNS(namespaceURI,qualifiedName){var node=new Attr();var pl=qualifiedName.split(':');node.ownerDocument=this;node.nodeName=qualifiedName;node.name=qualifiedName;node.namespaceURI=namespaceURI;node.specified=true;if(pl.length==2){node.prefix=pl[0];node.localName=pl[1];}else{//el.prefix = null;
  1315. node.localName=qualifiedName;}return node;}};_extends(Document,Node);function Element(){this._nsMap={};}Element.prototype={nodeType:ELEMENT_NODE,hasAttribute:function hasAttribute(name){return this.getAttributeNode(name)!=null;},getAttribute:function getAttribute(name){var attr=this.getAttributeNode(name);return attr&&attr.value||'';},getAttributeNode:function getAttributeNode(name){return this.attributes.getNamedItem(name);},setAttribute:function setAttribute(name,value){var attr=this.ownerDocument.createAttribute(name);attr.value=attr.nodeValue=""+value;this.setAttributeNode(attr);},removeAttribute:function removeAttribute(name){var attr=this.getAttributeNode(name);attr&&this.removeAttributeNode(attr);},//four real opeartion method
  1316. appendChild:function appendChild(newChild){if(newChild.nodeType===DOCUMENT_FRAGMENT_NODE){return this.insertBefore(newChild,null);}else{return _appendSingleChild(this,newChild);}},setAttributeNode:function setAttributeNode(newAttr){return this.attributes.setNamedItem(newAttr);},setAttributeNodeNS:function setAttributeNodeNS(newAttr){return this.attributes.setNamedItemNS(newAttr);},removeAttributeNode:function removeAttributeNode(oldAttr){//console.log(this == oldAttr.ownerElement)
  1317. return this.attributes.removeNamedItem(oldAttr.nodeName);},//get real attribute name,and remove it by removeAttributeNode
  1318. removeAttributeNS:function removeAttributeNS(namespaceURI,localName){var old=this.getAttributeNodeNS(namespaceURI,localName);old&&this.removeAttributeNode(old);},hasAttributeNS:function hasAttributeNS(namespaceURI,localName){return this.getAttributeNodeNS(namespaceURI,localName)!=null;},getAttributeNS:function getAttributeNS(namespaceURI,localName){var attr=this.getAttributeNodeNS(namespaceURI,localName);return attr&&attr.value||'';},setAttributeNS:function setAttributeNS(namespaceURI,qualifiedName,value){var attr=this.ownerDocument.createAttributeNS(namespaceURI,qualifiedName);attr.value=attr.nodeValue=""+value;this.setAttributeNode(attr);},getAttributeNodeNS:function getAttributeNodeNS(namespaceURI,localName){return this.attributes.getNamedItemNS(namespaceURI,localName);},getElementsByTagName:function getElementsByTagName(tagName){return new LiveNodeList(this,function(base){var ls=[];_visitNode(base,function(node){if(node!==base&&node.nodeType==ELEMENT_NODE&&(tagName==='*'||node.tagName==tagName)){ls.push(node);}});return ls;});},getElementsByTagNameNS:function getElementsByTagNameNS(namespaceURI,localName){return new LiveNodeList(this,function(base){var ls=[];_visitNode(base,function(node){if(node!==base&&node.nodeType===ELEMENT_NODE&&(namespaceURI==='*'||node.namespaceURI===namespaceURI)&&(localName==='*'||node.localName==localName)){ls.push(node);}});return ls;});}};Document.prototype.getElementsByTagName=Element.prototype.getElementsByTagName;Document.prototype.getElementsByTagNameNS=Element.prototype.getElementsByTagNameNS;_extends(Element,Node);function Attr(){}Attr.prototype.nodeType=ATTRIBUTE_NODE;_extends(Attr,Node);function CharacterData(){}CharacterData.prototype={data:'',substringData:function substringData(offset,count){return this.data.substring(offset,offset+count);},appendData:function appendData(text){text=this.data+text;this.nodeValue=this.data=text;this.length=text.length;},insertData:function insertData(offset,text){this.replaceData(offset,0,text);},appendChild:function appendChild(newChild){throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);},deleteData:function deleteData(offset,count){this.replaceData(offset,count,"");},replaceData:function replaceData(offset,count,text){var start=this.data.substring(0,offset);var end=this.data.substring(offset+count);text=start+text+end;this.nodeValue=this.data=text;this.length=text.length;}};_extends(CharacterData,Node);function Text(){}Text.prototype={nodeName:"#text",nodeType:TEXT_NODE,splitText:function splitText(offset){var text=this.data;var newText=text.substring(offset);text=text.substring(0,offset);this.data=this.nodeValue=text;this.length=text.length;var newNode=this.ownerDocument.createTextNode(newText);if(this.parentNode){this.parentNode.insertBefore(newNode,this.nextSibling);}return newNode;}};_extends(Text,CharacterData);function Comment(){}Comment.prototype={nodeName:"#comment",nodeType:COMMENT_NODE};_extends(Comment,CharacterData);function CDATASection(){}CDATASection.prototype={nodeName:"#cdata-section",nodeType:CDATA_SECTION_NODE};_extends(CDATASection,CharacterData);function DocumentType(){}DocumentType.prototype.nodeType=DOCUMENT_TYPE_NODE;_extends(DocumentType,Node);function Notation(){}Notation.prototype.nodeType=NOTATION_NODE;_extends(Notation,Node);function Entity(){}Entity.prototype.nodeType=ENTITY_NODE;_extends(Entity,Node);function EntityReference(){}EntityReference.prototype.nodeType=ENTITY_REFERENCE_NODE;_extends(EntityReference,Node);function DocumentFragment(){}DocumentFragment.prototype.nodeName="#document-fragment";DocumentFragment.prototype.nodeType=DOCUMENT_FRAGMENT_NODE;_extends(DocumentFragment,Node);function ProcessingInstruction(){}ProcessingInstruction.prototype.nodeType=PROCESSING_INSTRUCTION_NODE;_extends(ProcessingInstruction,Node);function XMLSerializer(){}XMLSerializer.prototype.serializeToString=function(node,isHtml,nodeFilter){return nodeSerializeToString.call(node,isHtml,nodeFilter);};Node.prototype.toString=nodeSerializeToString;function nodeSerializeToString(isHtml,nodeFilter){var buf=[];var refNode=this.nodeType==9&&this.documentElement||this;var prefix=refNode.prefix;var uri=refNode.namespaceURI;if(uri&&prefix==null){//console.log(prefix)
  1319. var prefix=refNode.lookupPrefix(uri);if(prefix==null){//isHTML = true;
  1320. var visibleNamespaces=[{namespace:uri,prefix:null}//{namespace:uri,prefix:''}
  1321. ];}}serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);//console.log('###',this.nodeType,uri,prefix,buf.join(''))
  1322. return buf.join('');}function needNamespaceDefine(node,isHTML,visibleNamespaces){var prefix=node.prefix||'';var uri=node.namespaceURI;// According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,
  1323. // and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :
  1324. // > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.
  1325. // in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)
  1326. // and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :
  1327. // > [...] Furthermore, the attribute value [...] must not be an empty string.
  1328. // so serializing empty namespace value like xmlns:ds="" would produce an invalid XML document.
  1329. if(!uri){return false;}if(prefix==="xml"&&uri===NAMESPACE.XML||uri===NAMESPACE.XMLNS){return false;}var i=visibleNamespaces.length;while(i--){var ns=visibleNamespaces[i];// get namespace prefix
  1330. if(ns.prefix===prefix){return ns.namespace!==uri;}}return true;}/**
  1331. * Well-formed constraint: No < in Attribute Values
  1332. * > The replacement text of any entity referred to directly or indirectly
  1333. * > in an attribute value must not contain a <.
  1334. * @see https://www.w3.org/TR/xml11/#CleanAttrVals
  1335. * @see https://www.w3.org/TR/xml11/#NT-AttValue
  1336. *
  1337. * Literal whitespace other than space that appear in attribute values
  1338. * are serialized as their entity references, so they will be preserved.
  1339. * (In contrast to whitespace literals in the input which are normalized to spaces)
  1340. * @see https://www.w3.org/TR/xml11/#AVNormalize
  1341. * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
  1342. */function addSerializedAttribute(buf,qualifiedName,value){buf.push(' ',qualifiedName,'="',value.replace(/[<>&"\t\n\r]/g,_xmlEncoder),'"');}function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){if(!visibleNamespaces){visibleNamespaces=[];}if(nodeFilter){node=nodeFilter(node);if(node){if(typeof node=='string'){buf.push(node);return;}}else{return;}//buf.sort.apply(attrs, attributeSorter);
  1343. }switch(node.nodeType){case ELEMENT_NODE:var attrs=node.attributes;var len=attrs.length;var child=node.firstChild;var nodeName=node.tagName;isHTML=NAMESPACE.isHTML(node.namespaceURI)||isHTML;var prefixedNodeName=nodeName;if(!isHTML&&!node.prefix&&node.namespaceURI){var defaultNS;// lookup current default ns from `xmlns` attribute
  1344. for(var ai=0;ai<attrs.length;ai++){if(attrs.item(ai).name==='xmlns'){defaultNS=attrs.item(ai).value;break;}}if(!defaultNS){// lookup current default ns in visibleNamespaces
  1345. for(var nsi=visibleNamespaces.length-1;nsi>=0;nsi--){var namespace=visibleNamespaces[nsi];if(namespace.prefix===''&&namespace.namespace===node.namespaceURI){defaultNS=namespace.namespace;break;}}}if(defaultNS!==node.namespaceURI){for(var nsi=visibleNamespaces.length-1;nsi>=0;nsi--){var namespace=visibleNamespaces[nsi];if(namespace.namespace===node.namespaceURI){if(namespace.prefix){prefixedNodeName=namespace.prefix+':'+nodeName;}break;}}}}buf.push('<',prefixedNodeName);for(var i=0;i<len;i++){// add namespaces for attributes
  1346. var attr=attrs.item(i);if(attr.prefix=='xmlns'){visibleNamespaces.push({prefix:attr.localName,namespace:attr.value});}else if(attr.nodeName=='xmlns'){visibleNamespaces.push({prefix:'',namespace:attr.value});}}for(var i=0;i<len;i++){var attr=attrs.item(i);if(needNamespaceDefine(attr,isHTML,visibleNamespaces)){var prefix=attr.prefix||'';var uri=attr.namespaceURI;addSerializedAttribute(buf,prefix?'xmlns:'+prefix:"xmlns",uri);visibleNamespaces.push({prefix:prefix,namespace:uri});}serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);}// add namespace for current node
  1347. if(nodeName===prefixedNodeName&&needNamespaceDefine(node,isHTML,visibleNamespaces)){var prefix=node.prefix||'';var uri=node.namespaceURI;addSerializedAttribute(buf,prefix?'xmlns:'+prefix:"xmlns",uri);visibleNamespaces.push({prefix:prefix,namespace:uri});}if(child||isHTML&&!/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){buf.push('>');//if is cdata child node
  1348. if(isHTML&&/^script$/i.test(nodeName)){while(child){if(child.data){buf.push(child.data);}else{serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice());}child=child.nextSibling;}}else{while(child){serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice());child=child.nextSibling;}}buf.push('</',prefixedNodeName,'>');}else{buf.push('/>');}// remove added visible namespaces
  1349. //visibleNamespaces.length = startVisibleNamespaces;
  1350. return;case DOCUMENT_NODE:case DOCUMENT_FRAGMENT_NODE:var child=node.firstChild;while(child){serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice());child=child.nextSibling;}return;case ATTRIBUTE_NODE:return addSerializedAttribute(buf,node.name,node.value);case TEXT_NODE:/**
  1351. * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
  1352. * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
  1353. * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
  1354. * `&amp;` and `&lt;` respectively.
  1355. * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
  1356. * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
  1357. * when that string is not marking the end of a CDATA section.
  1358. *
  1359. * In the content of elements, character data is any string of characters
  1360. * which does not contain the start-delimiter of any markup
  1361. * and does not include the CDATA-section-close delimiter, `]]>`.
  1362. *
  1363. * @see https://www.w3.org/TR/xml/#NT-CharData
  1364. * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
  1365. */return buf.push(node.data.replace(/[<&>]/g,_xmlEncoder));case CDATA_SECTION_NODE:return buf.push('<![CDATA[',node.data,']]>');case COMMENT_NODE:return buf.push("<!--",node.data,"-->");case DOCUMENT_TYPE_NODE:var pubid=node.publicId;var sysid=node.systemId;buf.push('<!DOCTYPE ',node.name);if(pubid){buf.push(' PUBLIC ',pubid);if(sysid&&sysid!='.'){buf.push(' ',sysid);}buf.push('>');}else if(sysid&&sysid!='.'){buf.push(' SYSTEM ',sysid,'>');}else{var sub=node.internalSubset;if(sub){buf.push(" [",sub,"]");}buf.push(">");}return;case PROCESSING_INSTRUCTION_NODE:return buf.push("<?",node.target," ",node.data,"?>");case ENTITY_REFERENCE_NODE:return buf.push('&',node.nodeName,';');//case ENTITY_NODE:
  1366. //case NOTATION_NODE:
  1367. default:buf.push('??',node.nodeName);}}function _importNode(doc,node,deep){var node2;switch(node.nodeType){case ELEMENT_NODE:node2=node.cloneNode(false);node2.ownerDocument=doc;//var attrs = node2.attributes;
  1368. //var len = attrs.length;
  1369. //for(var i=0;i<len;i++){
  1370. //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
  1371. //}
  1372. case DOCUMENT_FRAGMENT_NODE:break;case ATTRIBUTE_NODE:deep=true;break;//case ENTITY_REFERENCE_NODE:
  1373. //case PROCESSING_INSTRUCTION_NODE:
  1374. ////case TEXT_NODE:
  1375. //case CDATA_SECTION_NODE:
  1376. //case COMMENT_NODE:
  1377. // deep = false;
  1378. // break;
  1379. //case DOCUMENT_NODE:
  1380. //case DOCUMENT_TYPE_NODE:
  1381. //cannot be imported.
  1382. //case ENTITY_NODE:
  1383. //case NOTATION_NODE:
  1384. //can not hit in level3
  1385. //default:throw e;
  1386. }if(!node2){node2=node.cloneNode(false);//false
  1387. }node2.ownerDocument=doc;node2.parentNode=null;if(deep){var child=node.firstChild;while(child){node2.appendChild(_importNode(doc,child,deep));child=child.nextSibling;}}return node2;}//
  1388. //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
  1389. // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
  1390. function _cloneNode(doc,node,deep){var node2=new node.constructor();for(var n in node){if(Object.prototype.hasOwnProperty.call(node,n)){var v=node[n];if(_typeof2(v)!="object"){if(v!=node2[n]){node2[n]=v;}}}}if(node.childNodes){node2.childNodes=new NodeList();}node2.ownerDocument=doc;switch(node2.nodeType){case ELEMENT_NODE:var attrs=node.attributes;var attrs2=node2.attributes=new NamedNodeMap();var len=attrs.length;attrs2._ownerElement=node2;for(var i=0;i<len;i++){node2.setAttributeNode(_cloneNode(doc,attrs.item(i),true));}break;case ATTRIBUTE_NODE:deep=true;}if(deep){var child=node.firstChild;while(child){node2.appendChild(_cloneNode(doc,child,deep));child=child.nextSibling;}}return node2;}function __set__(object,key,value){object[key]=value;}//do dynamic
  1391. try{if(Object.defineProperty){Object.defineProperty(LiveNodeList.prototype,'length',{get:function get(){_updateLiveList(this);return this.$$length;}});Object.defineProperty(Node.prototype,'textContent',{get:function get(){return getTextContent(this);},set:function set(data){switch(this.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:while(this.firstChild){this.removeChild(this.firstChild);}if(data||String(data)){this.appendChild(this.ownerDocument.createTextNode(data));}break;default:this.data=data;this.value=data;this.nodeValue=data;}}});function getTextContent(node){switch(node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:var buf=[];node=node.firstChild;while(node){if(node.nodeType!==7&&node.nodeType!==8){buf.push(getTextContent(node));}node=node.nextSibling;}return buf.join('');default:return node.nodeValue;}}__set__=function __set__(object,key,value){//console.log(value)
  1392. object['$$'+key]=value;};}}catch(e){//ie8
  1393. }//if(typeof require == 'function'){
  1394. exports.DocumentType=DocumentType;exports.DOMException=DOMException;exports.DOMImplementation=DOMImplementation;exports.Element=Element;exports.Node=Node;exports.NodeList=NodeList;exports.XMLSerializer=XMLSerializer;//}
  1395. /***/},/***/"./node_modules/@xmldom/xmldom/lib/entities.js":/*!*****************************************************!*\
  1396. !*** ./node_modules/@xmldom/xmldom/lib/entities.js ***!
  1397. \*****************************************************/ /*! no static exports found */ /***/function node_modulesXmldomXmldomLibEntitiesJs(module,exports,__webpack_require__){var freeze=__webpack_require__(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js").freeze;/**
  1398. * The entities that are predefined in every XML document.
  1399. *
  1400. * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
  1401. * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
  1402. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
  1403. */exports.XML_ENTITIES=freeze({amp:'&',apos:"'",gt:'>',lt:'<',quot:'"'});/**
  1404. * A map of all entities that are detected in an HTML document.
  1405. * They contain all entries from `XML_ENTITIES`.
  1406. *
  1407. * @see XML_ENTITIES
  1408. * @see DOMParser.parseFromString
  1409. * @see DOMImplementation.prototype.createHTMLDocument
  1410. * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
  1411. * @see https://html.spec.whatwg.org/entities.json JSON
  1412. * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
  1413. * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
  1414. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
  1415. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
  1416. */exports.HTML_ENTITIES=freeze({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\uD835\uDD04",afr:"\uD835\uDD1E",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\uD835\uDD38",aopf:"\uD835\uDD52",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\uD835\uDC9C",ascr:"\uD835\uDCB6",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\uD835\uDD05",bfr:"\uD835\uDD1F",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\uD835\uDD39",bopf:"\uD835\uDD53",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\uD835\uDCB7",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\uD835\uDD20",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\uD835\uDD54",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\uD835\uDC9E",cscr:"\uD835\uDCB8",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\uD835\uDD07",dfr:"\uD835\uDD21",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\uD835\uDD3B",dopf:"\uD835\uDD55",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\uD835\uDC9F",dscr:"\uD835\uDCB9",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\uD835\uDD08",efr:"\uD835\uDD22",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\uD835\uDD3C",eopf:"\uD835\uDD56",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\uD835\uDD09",ffr:"\uD835\uDD23",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\uD835\uDD3D",fopf:"\uD835\uDD57",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\uD835\uDCBB",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\uD835\uDD0A",gfr:"\uD835\uDD24",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\uD835\uDD3E",gopf:"\uD835\uDD58",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\uD835\uDCA2",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\uD835\uDD25",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\uD835\uDD59",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\uD835\uDCBD",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\uD835\uDD26",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\uD835\uDD40",iopf:"\uD835\uDD5A",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\uD835\uDCBE",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\uD835\uDD0D",jfr:"\uD835\uDD27",jmath:"\u0237",Jopf:"\uD835\uDD41",jopf:"\uD835\uDD5B",Jscr:"\uD835\uDCA5",jscr:"\uD835\uDCBF",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\uD835\uDD0E",kfr:"\uD835\uDD28",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\uD835\uDD42",kopf:"\uD835\uDD5C",Kscr:"\uD835\uDCA6",kscr:"\uD835\uDCC0",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\uD835\uDD0F",lfr:"\uD835\uDD29",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\uD835\uDD43",lopf:"\uD835\uDD5D",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\uD835\uDCC1",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\uD835\uDD10",mfr:"\uD835\uDD2A",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\uD835\uDD44",mopf:"\uD835\uDD5E",mp:"\u2213",Mscr:"\u2133",mscr:"\uD835\uDCC2",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:"\n",nexist:"\u2204",nexists:"\u2204",Nfr:"\uD835\uDD11",nfr:"\uD835\uDD2B",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\uD835\uDD5F",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\uD835\uDCA9",nscr:"\uD835\uDCC3",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\uD835\uDD12",ofr:"\uD835\uDD2C",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\uD835\uDD46",oopf:"\uD835\uDD60",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\uD835\uDCAA",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\uD835\uDD13",pfr:"\uD835\uDD2D",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\uD835\uDD61",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\uD835\uDCAB",pscr:"\uD835\uDCC5",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\uD835\uDD14",qfr:"\uD835\uDD2E",qint:"\u2A0C",Qopf:"\u211A",qopf:"\uD835\uDD62",qprime:"\u2057",Qscr:"\uD835\uDCAC",qscr:"\uD835\uDCC6",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:"\"",quot:"\"",rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\uD835\uDD2F",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\uD835\uDD63",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\uD835\uDCC7",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\uD835\uDD16",sfr:"\uD835\uDD30",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\uD835\uDD4A",sopf:"\uD835\uDD64",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\uD835\uDCAE",sscr:"\uD835\uDCC8",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:"\t",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\uD835\uDD17",tfr:"\uD835\uDD31",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\uD835\uDD4B",topf:"\uD835\uDD65",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\uD835\uDCAF",tscr:"\uD835\uDCC9",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\uD835\uDD18",ufr:"\uD835\uDD32",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\uD835\uDD4C",uopf:"\uD835\uDD66",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\uD835\uDCB0",uscr:"\uD835\uDCCA",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\uD835\uDD19",vfr:"\uD835\uDD33",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\uD835\uDD4D",vopf:"\uD835\uDD67",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\uD835\uDCB1",vscr:"\uD835\uDCCB",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\uD835\uDD1A",wfr:"\uD835\uDD34",Wopf:"\uD835\uDD4E",wopf:"\uD835\uDD68",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\uD835\uDCB2",wscr:"\uD835\uDCCC",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\uD835\uDD1B",xfr:"\uD835\uDD35",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\uD835\uDD4F",xopf:"\uD835\uDD69",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\uD835\uDCB3",xscr:"\uD835\uDCCD",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\uD835\uDD1C",yfr:"\uD835\uDD36",YIcy:"\u0407",yicy:"\u0457",Yopf:"\uD835\uDD50",yopf:"\uD835\uDD6A",Yscr:"\uD835\uDCB4",yscr:"\uD835\uDCCE",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\uD835\uDD37",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\uD835\uDD6B",Zscr:"\uD835\uDCB5",zscr:"\uD835\uDCCF",zwj:"\u200D",zwnj:"\u200C"});/**
  1417. * @deprecated use `HTML_ENTITIES` instead
  1418. * @see HTML_ENTITIES
  1419. */exports.entityMap=exports.HTML_ENTITIES;/***/},/***/"./node_modules/@xmldom/xmldom/lib/index.js":/*!**************************************************!*\
  1420. !*** ./node_modules/@xmldom/xmldom/lib/index.js ***!
  1421. \**************************************************/ /*! no static exports found */ /***/function node_modulesXmldomXmldomLibIndexJs(module,exports,__webpack_require__){var dom=__webpack_require__(/*! ./dom */"./node_modules/@xmldom/xmldom/lib/dom.js");exports.DOMImplementation=dom.DOMImplementation;exports.XMLSerializer=dom.XMLSerializer;exports.DOMParser=__webpack_require__(/*! ./dom-parser */"./node_modules/@xmldom/xmldom/lib/dom-parser.js").DOMParser;/***/},/***/"./node_modules/@xmldom/xmldom/lib/sax.js":/*!************************************************!*\
  1422. !*** ./node_modules/@xmldom/xmldom/lib/sax.js ***!
  1423. \************************************************/ /*! no static exports found */ /***/function node_modulesXmldomXmldomLibSaxJs(module,exports,__webpack_require__){var NAMESPACE=__webpack_require__(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js").NAMESPACE;//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
  1424. //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
  1425. //[5] Name ::= NameStartChar (NameChar)*
  1426. var nameStartChar=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
  1427. var nameChar=new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");var tagNamePattern=new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
  1428. //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
  1429. //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
  1430. //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
  1431. var S_TAG=0;//tag name offerring
  1432. var S_ATTR=1;//attr name offerring
  1433. var S_ATTR_SPACE=2;//attr name end and space offer
  1434. var S_EQ=3;//=space?
  1435. var S_ATTR_NOQUOT_VALUE=4;//attr value(no quot value only)
  1436. var S_ATTR_END=5;//attr value end and no space(quot end)
  1437. var S_TAG_SPACE=6;//(attr value end || tag end ) && (space offer)
  1438. var S_TAG_CLOSE=7;//closed el<el />
  1439. /**
  1440. * Creates an error that will not be caught by XMLReader aka the SAX parser.
  1441. *
  1442. * @param {string} message
  1443. * @param {any?} locator Optional, can provide details about the location in the source
  1444. * @constructor
  1445. */function ParseError(message,locator){this.message=message;this.locator=locator;if(Error.captureStackTrace)Error.captureStackTrace(this,ParseError);}ParseError.prototype=new Error();ParseError.prototype.name=ParseError.name;function XMLReader(){}XMLReader.prototype={parse:function parse(source,defaultNSMap,entityMap){var domBuilder=this.domBuilder;domBuilder.startDocument();_copy(defaultNSMap,defaultNSMap={});_parse(source,defaultNSMap,entityMap,domBuilder,this.errorHandler);domBuilder.endDocument();}};function _parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){function fixedFromCharCode(code){// String.prototype.fromCharCode does not supports
  1446. // > 2 bytes unicode chars directly
  1447. if(code>0xffff){code-=0x10000;var surrogate1=0xd800+(code>>10),surrogate2=0xdc00+(code&0x3ff);return String.fromCharCode(surrogate1,surrogate2);}else{return String.fromCharCode(code);}}function entityReplacer(a){var k=a.slice(1,-1);if(Object.hasOwnProperty.call(entityMap,k)){return entityMap[k];}else if(k.charAt(0)==='#'){return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')));}else{errorHandler.error('entity not found:'+a);return a;}}function appendText(end){//has some bugs
  1448. if(end>start){var xt=source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);locator&&position(start);domBuilder.characters(xt,0,end-start);start=end;}}function position(p,m){while(p>=lineEnd&&(m=linePattern.exec(source))){lineStart=m.index;lineEnd=lineStart+m[0].length;locator.lineNumber++;//console.log('line++:',locator,startPos,endPos)
  1449. }locator.columnNumber=p-lineStart+1;}var lineStart=0;var lineEnd=0;var linePattern=/.*(?:\r\n?|\n)|.*$/g;var locator=domBuilder.locator;var parseStack=[{currentNSMap:defaultNSMapCopy}];var closeMap={};var start=0;while(true){try{var tagStart=source.indexOf('<',start);if(tagStart<0){if(!source.substr(start).match(/^\s*$/)){var doc=domBuilder.doc;var text=doc.createTextNode(source.substr(start));doc.appendChild(text);domBuilder.currentElement=text;}return;}if(tagStart>start){appendText(tagStart);}switch(source.charAt(tagStart+1)){case'/':var end=source.indexOf('>',tagStart+3);var tagName=source.substring(tagStart+2,end).replace(/[ \t\n\r]+$/g,'');var config=parseStack.pop();if(end<0){tagName=source.substring(tagStart+2).replace(/[\s<].*/,'');errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);end=tagStart+1+tagName.length;}else if(tagName.match(/\s</)){tagName=tagName.replace(/[\s<].*/,'');errorHandler.error("end tag name: "+tagName+' maybe not complete');end=tagStart+1+tagName.length;}var localNSMap=config.localNSMap;var endMatch=config.tagName==tagName;var endIgnoreCaseMach=endMatch||config.tagName&&config.tagName.toLowerCase()==tagName.toLowerCase();if(endIgnoreCaseMach){domBuilder.endElement(config.uri,config.localName,tagName);if(localNSMap){for(var prefix in localNSMap){if(Object.prototype.hasOwnProperty.call(localNSMap,prefix)){domBuilder.endPrefixMapping(prefix);}}}if(!endMatch){errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName);// No known test case
  1450. }}else{parseStack.push(config);}end++;break;// end elment
  1451. case'?':// <?...?>
  1452. locator&&position(tagStart);end=parseInstruction(source,tagStart,domBuilder);break;case'!':// <!doctype,<![CDATA,<!--
  1453. locator&&position(tagStart);end=parseDCC(source,tagStart,domBuilder,errorHandler);break;default:locator&&position(tagStart);var el=new ElementAttributes();var currentNSMap=parseStack[parseStack.length-1].currentNSMap;//elStartEnd
  1454. var end=parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);var len=el.length;if(!el.closed&&fixSelfClosed(source,end,el.tagName,closeMap)){el.closed=true;if(!entityMap.nbsp){errorHandler.warning('unclosed xml attribute');}}if(locator&&len){var locator2=copyLocator(locator,{});//try{//attribute position fixed
  1455. for(var i=0;i<len;i++){var a=el[i];position(a.offset);a.locator=copyLocator(locator,{});}domBuilder.locator=locator2;if(appendElement(el,domBuilder,currentNSMap)){parseStack.push(el);}domBuilder.locator=locator;}else{if(appendElement(el,domBuilder,currentNSMap)){parseStack.push(el);}}if(NAMESPACE.isHTML(el.uri)&&!el.closed){end=parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder);}else{end++;}}}catch(e){if(e instanceof ParseError){throw e;}errorHandler.error('element parse error: '+e);end=-1;}if(end>start){start=end;}else{//TODO: 这里有可能sax回退,有位置错误风险
  1456. appendText(Math.max(tagStart,start)+1);}}}function copyLocator(f,t){t.lineNumber=f.lineNumber;t.columnNumber=f.columnNumber;return t;}/**
  1457. * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
  1458. * @return end of the elementStartPart(end of elementEndPart for selfClosed el)
  1459. */function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){/**
  1460. * @param {string} qname
  1461. * @param {string} value
  1462. * @param {number} startIndex
  1463. */function addAttribute(qname,value,startIndex){if(el.attributeNames.hasOwnProperty(qname)){errorHandler.fatalError('Attribute '+qname+' redefined');}el.addValue(qname,// @see https://www.w3.org/TR/xml/#AVNormalize
  1464. // since the xmldom sax parser does not "interpret" DTD the following is not implemented:
  1465. // - recursive replacement of (DTD) entity references
  1466. // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
  1467. value.replace(/[\t\n\r]/g,' ').replace(/&#?\w+;/g,entityReplacer),startIndex);}var attrName;var value;var p=++start;var s=S_TAG;//status
  1468. while(true){var c=source.charAt(p);switch(c){case'=':if(s===S_ATTR){//attrName
  1469. attrName=source.slice(start,p);s=S_EQ;}else if(s===S_ATTR_SPACE){s=S_EQ;}else{//fatalError: equal must after attrName or space after attrName
  1470. throw new Error('attribute equal must after attrName');// No known test case
  1471. }break;case'\'':case'"':if(s===S_EQ||s===S_ATTR//|| s == S_ATTR_SPACE
  1472. ){//equal
  1473. if(s===S_ATTR){errorHandler.warning('attribute value must after "="');attrName=source.slice(start,p);}start=p+1;p=source.indexOf(c,start);if(p>0){value=source.slice(start,p);addAttribute(attrName,value,start-1);s=S_ATTR_END;}else{//fatalError: no end quot match
  1474. throw new Error('attribute value no end \''+c+'\' match');}}else if(s==S_ATTR_NOQUOT_VALUE){value=source.slice(start,p);addAttribute(attrName,value,start);errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');start=p+1;s=S_ATTR_END;}else{//fatalError: no equal before
  1475. throw new Error('attribute value must after "="');// No known test case
  1476. }break;case'/':switch(s){case S_TAG:el.setTagName(source.slice(start,p));case S_ATTR_END:case S_TAG_SPACE:case S_TAG_CLOSE:s=S_TAG_CLOSE;el.closed=true;case S_ATTR_NOQUOT_VALUE:case S_ATTR:break;case S_ATTR_SPACE:el.closed=true;break;//case S_EQ:
  1477. default:throw new Error("attribute invalid close char('/')");// No known test case
  1478. }break;case''://end document
  1479. errorHandler.error('unexpected end of input');if(s==S_TAG){el.setTagName(source.slice(start,p));}return p;case'>':switch(s){case S_TAG:el.setTagName(source.slice(start,p));case S_ATTR_END:case S_TAG_SPACE:case S_TAG_CLOSE:break;//normal
  1480. case S_ATTR_NOQUOT_VALUE://Compatible state
  1481. case S_ATTR:value=source.slice(start,p);if(value.slice(-1)==='/'){el.closed=true;value=value.slice(0,-1);}case S_ATTR_SPACE:if(s===S_ATTR_SPACE){value=attrName;}if(s==S_ATTR_NOQUOT_VALUE){errorHandler.warning('attribute "'+value+'" missed quot(")!');addAttribute(attrName,value,start);}else{if(!NAMESPACE.isHTML(currentNSMap[''])||!value.match(/^(?:disabled|checked|selected)$/i)){errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!');}addAttribute(value,value,start);}break;case S_EQ:throw new Error('attribute value missed!!');}// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName))
  1482. return p;/*xml space '\x20' | #x9 | #xD | #xA; */case"\x80":c=' ';default:if(c<=' '){//space
  1483. switch(s){case S_TAG:el.setTagName(source.slice(start,p));//tagName
  1484. s=S_TAG_SPACE;break;case S_ATTR:attrName=source.slice(start,p);s=S_ATTR_SPACE;break;case S_ATTR_NOQUOT_VALUE:var value=source.slice(start,p);errorHandler.warning('attribute "'+value+'" missed quot(")!!');addAttribute(attrName,value,start);case S_ATTR_END:s=S_TAG_SPACE;break;//case S_TAG_SPACE:
  1485. //case S_EQ:
  1486. //case S_ATTR_SPACE:
  1487. // void();break;
  1488. //case S_TAG_CLOSE:
  1489. //ignore warning
  1490. }}else{//not space
  1491. //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
  1492. //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
  1493. switch(s){//case S_TAG:void();break;
  1494. //case S_ATTR:void();break;
  1495. //case S_ATTR_NOQUOT_VALUE:void();break;
  1496. case S_ATTR_SPACE:el.tagName;if(!NAMESPACE.isHTML(currentNSMap[''])||!attrName.match(/^(?:disabled|checked|selected)$/i)){errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!');}addAttribute(attrName,attrName,start);start=p;s=S_ATTR;break;case S_ATTR_END:errorHandler.warning('attribute space is required"'+attrName+'"!!');case S_TAG_SPACE:s=S_ATTR;start=p;break;case S_EQ:s=S_ATTR_NOQUOT_VALUE;start=p;break;case S_TAG_CLOSE:throw new Error("elements closed character '/' and '>' must be connected to");}}}//end outer switch
  1497. //console.log('p++',p)
  1498. p++;}}/**
  1499. * @return true if has new namespace define
  1500. */function appendElement(el,domBuilder,currentNSMap){var tagName=el.tagName;var localNSMap=null;//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
  1501. var i=el.length;while(i--){var a=el[i];var qName=a.qName;var value=a.value;var nsp=qName.indexOf(':');if(nsp>0){var prefix=a.prefix=qName.slice(0,nsp);var localName=qName.slice(nsp+1);var nsPrefix=prefix==='xmlns'&&localName;}else{localName=qName;prefix=null;nsPrefix=qName==='xmlns'&&'';}//can not set prefix,because prefix !== ''
  1502. a.localName=localName;//prefix == null for no ns prefix attribute
  1503. if(nsPrefix!==false){//hack!!
  1504. if(localNSMap==null){localNSMap={};//console.log(currentNSMap,0)
  1505. _copy(currentNSMap,currentNSMap={});//console.log(currentNSMap,1)
  1506. }currentNSMap[nsPrefix]=localNSMap[nsPrefix]=value;a.uri=NAMESPACE.XMLNS;domBuilder.startPrefixMapping(nsPrefix,value);}}var i=el.length;while(i--){a=el[i];var prefix=a.prefix;if(prefix){//no prefix attribute has no namespace
  1507. if(prefix==='xml'){a.uri=NAMESPACE.XML;}if(prefix!=='xmlns'){a.uri=currentNSMap[prefix||''];//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
  1508. }}}var nsp=tagName.indexOf(':');if(nsp>0){prefix=el.prefix=tagName.slice(0,nsp);localName=el.localName=tagName.slice(nsp+1);}else{prefix=null;//important!!
  1509. localName=el.localName=tagName;}//no prefix element has default namespace
  1510. var ns=el.uri=currentNSMap[prefix||''];domBuilder.startElement(ns,localName,tagName,el);//endPrefixMapping and startPrefixMapping have not any help for dom builder
  1511. //localNSMap = null
  1512. if(el.closed){domBuilder.endElement(ns,localName,tagName);if(localNSMap){for(prefix in localNSMap){if(Object.prototype.hasOwnProperty.call(localNSMap,prefix)){domBuilder.endPrefixMapping(prefix);}}}}else{el.currentNSMap=currentNSMap;el.localNSMap=localNSMap;//parseStack.push(el);
  1513. return true;}}function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){if(/^(?:script|textarea)$/i.test(tagName)){var elEndStart=source.indexOf('</'+tagName+'>',elStartEnd);var text=source.substring(elStartEnd+1,elEndStart);if(/[&<]/.test(text)){if(/^script$/i.test(tagName)){//if(!/\]\]>/.test(text)){
  1514. //lexHandler.startCDATA();
  1515. domBuilder.characters(text,0,text.length);//lexHandler.endCDATA();
  1516. return elEndStart;//}
  1517. }//}else{//text area
  1518. text=text.replace(/&#?\w+;/g,entityReplacer);domBuilder.characters(text,0,text.length);return elEndStart;//}
  1519. }}return elStartEnd+1;}function fixSelfClosed(source,elStartEnd,tagName,closeMap){//if(tagName in closeMap){
  1520. var pos=closeMap[tagName];if(pos==null){//console.log(tagName)
  1521. pos=source.lastIndexOf('</'+tagName+'>');if(pos<elStartEnd){//忘记闭合
  1522. pos=source.lastIndexOf('</'+tagName);}closeMap[tagName]=pos;}return pos<elStartEnd;//}
  1523. }function _copy(source,target){for(var n in source){if(Object.prototype.hasOwnProperty.call(source,n)){target[n]=source[n];}}}function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
  1524. var next=source.charAt(start+2);switch(next){case'-':if(source.charAt(start+3)==='-'){var end=source.indexOf('-->',start+4);//append comment source.substring(4,end)//<!--
  1525. if(end>start){domBuilder.comment(source,start+4,end-start-4);return end+3;}else{errorHandler.error("Unclosed comment");return-1;}}else{//error
  1526. return-1;}default:if(source.substr(start+3,6)=='CDATA['){var end=source.indexOf(']]>',start+9);domBuilder.startCDATA();domBuilder.characters(source,start+9,end-start-9);domBuilder.endCDATA();return end+3;}//<!DOCTYPE
  1527. //startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
  1528. var matchs=split(source,start);var len=matchs.length;if(len>1&&/!doctype/i.test(matchs[0][0])){var name=matchs[1][0];var pubid=false;var sysid=false;if(len>3){if(/^public$/i.test(matchs[2][0])){pubid=matchs[3][0];sysid=len>4&&matchs[4][0];}else if(/^system$/i.test(matchs[2][0])){sysid=matchs[3][0];}}var lastMatch=matchs[len-1];domBuilder.startDTD(name,pubid,sysid);domBuilder.endDTD();return lastMatch.index+lastMatch[0].length;}}return-1;}function parseInstruction(source,start,domBuilder){var end=source.indexOf('?>',start);if(end){var match=source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(match){match[0].length;domBuilder.processingInstruction(match[1],match[2]);return end+2;}else{//error
  1529. return-1;}}return-1;}function ElementAttributes(){this.attributeNames={};}ElementAttributes.prototype={setTagName:function setTagName(tagName){if(!tagNamePattern.test(tagName)){throw new Error('invalid tagName:'+tagName);}this.tagName=tagName;},addValue:function addValue(qName,value,offset){if(!tagNamePattern.test(qName)){throw new Error('invalid attribute:'+qName);}this.attributeNames[qName]=this.length;this[this.length++]={qName:qName,value:value,offset:offset};},length:0,getLocalName:function getLocalName(i){return this[i].localName;},getLocator:function getLocator(i){return this[i].locator;},getQName:function getQName(i){return this[i].qName;},getURI:function getURI(i){return this[i].uri;},getValue:function getValue(i){return this[i].value;}// ,getIndex:function(uri, localName)){
  1530. // if(localName){
  1531. //
  1532. // }else{
  1533. // var qName = uri
  1534. // }
  1535. // },
  1536. // getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
  1537. // getType:function(uri,localName){}
  1538. // getType:function(i){},
  1539. };function split(source,start){var match;var buf=[];var reg=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;reg.lastIndex=start;reg.exec(source);//skip <
  1540. while(match=reg.exec(source)){buf.push(match);if(match[1])return buf;}}exports.XMLReader=XMLReader;exports.ParseError=ParseError;/***/},/***/"./node_modules/process/browser.js":/*!*****************************************!*\
  1541. !*** ./node_modules/process/browser.js ***!
  1542. \*****************************************/ /*! no static exports found */ /***/function node_modulesProcessBrowserJs(module,exports){// shim for using process in browser
  1543. var process=module.exports={};// cached from whatever global is present so that test runners that stub it
  1544. // don't break things. But we need to wrap it in a try catch in case it is
  1545. // wrapped in strict mode code which doesn't define any globals. It's inside a
  1546. // function because try/catches deoptimize in certain engines.
  1547. var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error('setTimeout has not been defined');}function defaultClearTimeout(){throw new Error('clearTimeout has not been defined');}(function(){try{if(typeof setTimeout==='function'){cachedSetTimeout=setTimeout;}else{cachedSetTimeout=defaultSetTimout;}}catch(e){cachedSetTimeout=defaultSetTimout;}try{if(typeof clearTimeout==='function'){cachedClearTimeout=clearTimeout;}else{cachedClearTimeout=defaultClearTimeout;}}catch(e){cachedClearTimeout=defaultClearTimeout;}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){//normal enviroments in sane situations
  1548. return setTimeout(fun,0);}// if setTimeout wasn't available but was latter defined
  1549. if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0);}try{// when when somebody has screwed with setTimeout but no I.E. maddness
  1550. return cachedSetTimeout(fun,0);}catch(e){try{// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1551. return cachedSetTimeout.call(null,fun,0);}catch(e){// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  1552. return cachedSetTimeout.call(this,fun,0);}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){//normal enviroments in sane situations
  1553. return clearTimeout(marker);}// if clearTimeout wasn't available but was latter defined
  1554. if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker);}try{// when when somebody has screwed with setTimeout but no I.E. maddness
  1555. return cachedClearTimeout(marker);}catch(e){try{// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1556. return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  1557. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  1558. return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}queueIndex=-1;len=queue.length;}currentQueue=null;draining=false;runClearTimeout(timeout);}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};// v8 likes predictible objects
  1559. function Item(fun,array){this.fun=fun;this.array=array;}Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';// empty string to avoid regexp issues
  1560. process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};/***/},/***/"./node_modules/webpack/buildin/amd-options.js":/*!****************************************!*\
  1561. !*** (webpack)/buildin/amd-options.js ***!
  1562. \****************************************/ /*! no static exports found */ /***/function node_modulesWebpackBuildinAmdOptionsJs(module,exports){/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__){/* globals __webpack_amd_options__ */module.exports=__webpack_amd_options__;/* WEBPACK VAR INJECTION */}).call(this,{});/***/},/***/"./node_modules/webpack/buildin/global.js":/*!***********************************!*\
  1563. !*** (webpack)/buildin/global.js ***!
  1564. \***********************************/ /*! no static exports found */ /***/function node_modulesWebpackBuildinGlobalJs(module,exports){var g;// This works in non-strict mode
  1565. g=function(){return this;}();try{// This works if eval is allowed (see CSP)
  1566. g=g||new Function("return this")();}catch(e){// This works if the window reference is available
  1567. if((typeof window==="undefined"?"undefined":_typeof2(window))==="object")g=window;}// g can still be undefined, but nothing to do about it...
  1568. // We return undefined, instead of nothing here, so it's
  1569. // easier to handle this case. if(!global) { ...}
  1570. module.exports=g;/***/},/***/"./node_modules/webpack/buildin/module.js":/*!***********************************!*\
  1571. !*** (webpack)/buildin/module.js ***!
  1572. \***********************************/ /*! no static exports found */ /***/function node_modulesWebpackBuildinModuleJs(module,exports){module.exports=function(module){if(!module.webpackPolyfill){module.deprecate=function(){};module.paths=[];// module.parent = undefined by default
  1573. if(!module.children)module.children=[];Object.defineProperty(module,"loaded",{enumerable:true,get:function get(){return module.l;}});Object.defineProperty(module,"id",{enumerable:true,get:function get(){return module.i;}});module.webpackPolyfill=1;}return module;};/***/},/***/"./package.json":/*!**********************!*\
  1574. !*** ./package.json ***!
  1575. \**********************/ /*! exports provided: name, version, description, main, types, scripts, repository, keywords, author, license, bugs, homepage, dependencies, devDependencies, default */ /***/function packageJson(module){module.exports=JSON.parse("{\"name\":\"cos-js-sdk-v5\",\"version\":\"1.4.21\",\"description\":\"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)\",\"main\":\"dist/cos-js-sdk-v5.js\",\"types\":\"index.d.ts\",\"scripts\":{\"prettier\":\"prettier --write src demo/demo.js test/test.js server/sts.js index.d.ts\",\"server\":\"node server/sts.js\",\"dev\":\"cross-env NODE_ENV=development webpack -w --mode=development\",\"build\":\"cross-env NODE_ENV=production webpack --mode=production\",\"cos-auth.min.js\":\"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m\",\"test\":\"jest --runInBand --coverage\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/tencentyun/cos-js-sdk-v5.git\"},\"keywords\":[],\"author\":\"carsonxu\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/tencentyun/cos-js-sdk-v5/issues\"},\"homepage\":\"https://github.com/tencentyun/cos-js-sdk-v5#readme\",\"dependencies\":{\"@xmldom/xmldom\":\"^0.8.6\"},\"devDependencies\":{\"@babel/core\":\"7.17.9\",\"@babel/plugin-transform-runtime\":\"7.18.10\",\"@babel/preset-env\":\"7.16.11\",\"babel-loader\":\"8.2.5\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^5.2.0\",\"express\":\"^4.16.4\",\"jest\":\"^29.3.1\",\"jest-environment-jsdom\":\"^29.3.1\",\"prettier\":\"^3.0.1\",\"qcloud-cos-sts\":\"^3.0.2\",\"request\":\"^2.87.0\",\"terser-webpack-plugin\":\"4.2.3\",\"uglifyjs\":\"^2.4.11\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}");/***/},/***/"./src/advance.js":/*!************************!*\
  1576. !*** ./src/advance.js ***!
  1577. \************************/ /*! no static exports found */ /***/function srcAdvanceJs(module,exports,__webpack_require__){var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");var session=__webpack_require__(/*! ./session */"./src/session.js");var Async=__webpack_require__(/*! ./async */"./src/async.js");var EventProxy=__webpack_require__(/*! ./event */"./src/event.js").EventProxy;var util=__webpack_require__(/*! ./util */"./src/util.js");var Tracker=__webpack_require__(/*! ./tracker */"./src/tracker.js");// 文件分块上传全过程,暴露的分块上传接口
  1578. function sliceUploadFile(params,callback){var self=this;var ep=new EventProxy();var TaskId=params.TaskId;var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var Body=params.Body;var ChunkSize=params.ChunkSize||params.SliceSize||self.options.ChunkSize;var AsyncLimit=params.AsyncLimit;var StorageClass=params.StorageClass;var ServerSideEncryption=params.ServerSideEncryption;var FileSize;var onProgress;var onHashProgress=params.onHashProgress;var tracker=params.tracker;tracker&&tracker.setParams({chunkSize:ChunkSize});// 上传过程中出现错误,返回错误
  1579. ep.on('error',function(err){if(!self._isRunningTask(TaskId))return;err.UploadId=params.UploadData.UploadId||'';return callback(err);});// 上传分块完成,开始 uploadSliceComplete 操作
  1580. ep.on('upload_complete',function(UploadCompleteData){var _UploadCompleteData=util.extend({UploadId:params.UploadData.UploadId||''},UploadCompleteData);callback(null,_UploadCompleteData);});// 上传分块完成,开始 uploadSliceComplete 操作
  1581. ep.on('upload_slice_complete',function(UploadData){var metaHeaders={};util.each(params.Headers,function(val,k){var shortKey=k.toLowerCase();if(shortKey.indexOf('x-cos-meta-')===0||shortKey==='pic-operations')metaHeaders[k]=val;});uploadSliceComplete.call(self,{Bucket:Bucket,Region:Region,Key:Key,UploadId:UploadData.UploadId,SliceList:UploadData.SliceList,Headers:metaHeaders,tracker:tracker},function(err,data){if(!self._isRunningTask(TaskId))return;session.removeUsing(UploadData.UploadId);if(err){onProgress(null,true);return ep.emit('error',err);}session.removeUploadId.call(self,UploadData.UploadId);onProgress({loaded:FileSize,total:FileSize},true);ep.emit('upload_complete',data);});});// 获取 UploadId 完成,开始上传每个分片
  1582. ep.on('get_upload_data_finish',function(UploadData){// 处理 UploadId 缓存
  1583. var uuid=session.getFileId(Body,params.ChunkSize,Bucket,Key);uuid&&session.saveUploadId.call(self,uuid,UploadData.UploadId,self.options.UploadIdCacheLimit);// 缓存 UploadId
  1584. session.setUsing(UploadData.UploadId);// 标记 UploadId 为正在使用
  1585. // 获取 UploadId
  1586. onProgress(null,true);// 任务状态开始 uploading
  1587. uploadSliceList.call(self,{TaskId:TaskId,Bucket:Bucket,Region:Region,Key:Key,Body:Body,FileSize:FileSize,SliceSize:ChunkSize,AsyncLimit:AsyncLimit,ServerSideEncryption:ServerSideEncryption,UploadData:UploadData,Headers:params.Headers,onProgress:onProgress,tracker:tracker},function(err,data){if(!self._isRunningTask(TaskId))return;if(err){onProgress(null,true);return ep.emit('error',err);}ep.emit('upload_slice_complete',data);});});// 开始获取文件 UploadId,里面会视情况计算 ETag,并比对,保证文件一致性,也优化上传
  1588. ep.on('get_file_size_finish',function(){onProgress=util.throttleOnProgress.call(self,FileSize,params.onProgress);if(params.UploadData.UploadId){ep.emit('get_upload_data_finish',params.UploadData);}else{var _params=util.extend({TaskId:TaskId,Bucket:Bucket,Region:Region,Key:Key,Headers:params.Headers,StorageClass:StorageClass,Body:Body,FileSize:FileSize,SliceSize:ChunkSize,onHashProgress:onHashProgress,tracker:tracker},params);getUploadIdAndPartList.call(self,_params,function(err,UploadData){if(!self._isRunningTask(TaskId))return;if(err)return ep.emit('error',err);params.UploadData.UploadId=UploadData.UploadId;params.UploadData.PartList=UploadData.PartList;ep.emit('get_upload_data_finish',params.UploadData);});}});// 获取上传文件大小
  1589. FileSize=params.ContentLength;delete params.ContentLength;!params.Headers&&(params.Headers={});util.each(params.Headers,function(item,key){if(key.toLowerCase()==='content-length'){delete params.Headers[key];}});// 控制分片大小
  1590. (function(){var SIZE=[1,2,4,8,16,32,64,128,256,512,1024,1024*2,1024*4,1024*5];var AutoChunkSize=1024*1024;for(var i=0;i<SIZE.length;i++){AutoChunkSize=SIZE[i]*1024*1024;if(FileSize/AutoChunkSize<=self.options.MaxPartNumber)break;}params.ChunkSize=params.SliceSize=ChunkSize=Math.max(ChunkSize,AutoChunkSize);})();// 开始上传
  1591. if(FileSize===0){params.Body='';params.ContentLength=0;params.SkipTask=true;self.putObject(params,callback);}else{ep.emit('get_file_size_finish');}}// 获取上传任务的 UploadId
  1592. function getUploadIdAndPartList(params,callback){var TaskId=params.TaskId;var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var StorageClass=params.StorageClass;var self=this;// 计算 ETag
  1593. var ETagMap={};var FileSize=params.FileSize;var SliceSize=params.SliceSize;var SliceCount=Math.ceil(FileSize/SliceSize);var FinishSize=0;var onHashProgress=util.throttleOnProgress.call(self,FileSize,params.onHashProgress);var getChunkETag=function getChunkETag(PartNumber,callback){var start=SliceSize*(PartNumber-1);var end=Math.min(start+SliceSize,FileSize);var ChunkSize=end-start;if(ETagMap[PartNumber]){callback(null,{PartNumber:PartNumber,ETag:ETagMap[PartNumber],Size:ChunkSize});}else{util.fileSlice(params.Body,start,end,false,function(chunkItem){util.getFileMd5(chunkItem,function(err,md5){if(err)return callback(util.error(err));var ETag='"'+md5+'"';ETagMap[PartNumber]=ETag;FinishSize+=ChunkSize;onHashProgress({loaded:FinishSize,total:FileSize});callback(null,{PartNumber:PartNumber,ETag:ETag,Size:ChunkSize});});});}};// 通过和文件的 md5 对比,判断 UploadId 是否可用
  1594. var isAvailableUploadList=function isAvailableUploadList(PartList,callback){var PartCount=PartList.length;// 如果没有分片,通过
  1595. if(PartCount===0){return callback(null,true);}// 检查分片数量
  1596. if(PartCount>SliceCount){return callback(null,false);}// 检查分片大小
  1597. if(PartCount>1){var PartSliceSize=Math.max(PartList[0].Size,PartList[1].Size);if(PartSliceSize!==SliceSize){return callback(null,false);}}// 逐个分片计算并检查 ETag 是否一致
  1598. var next=function next(index){if(index<PartCount){var Part=PartList[index];getChunkETag(Part.PartNumber,function(err,chunk){if(chunk&&chunk.ETag===Part.ETag&&chunk.Size===Part.Size){next(index+1);}else{callback(null,false);}});}else{callback(null,true);}};next(0);};var ep=new EventProxy();ep.on('error',function(errData){if(!self._isRunningTask(TaskId))return;return callback(errData);});// 存在 UploadId
  1599. ep.on('upload_id_available',function(UploadData){// 转换成 map
  1600. var map={};var list=[];util.each(UploadData.PartList,function(item){map[item.PartNumber]=item;});for(var PartNumber=1;PartNumber<=SliceCount;PartNumber++){var item=map[PartNumber];if(item){item.PartNumber=PartNumber;item.Uploaded=true;}else{item={PartNumber:PartNumber,ETag:null,Uploaded:false};}list.push(item);}UploadData.PartList=list;callback(null,UploadData);});// 不存在 UploadId, 初始化生成 UploadId
  1601. ep.on('no_available_upload_id',function(){if(!self._isRunningTask(TaskId))return;var _params=util.extend({Bucket:Bucket,Region:Region,Key:Key,Query:util.clone(params.Query),StorageClass:StorageClass,Body:params.Body,calledBySdk:'sliceUploadFile',tracker:params.tracker},params);var headers=util.clone(params.Headers);delete headers['x-cos-mime-limit'];_params.Headers=headers;self.multipartInit(_params,function(err,data){if(!self._isRunningTask(TaskId))return;if(err)return ep.emit('error',err);var UploadId=data.UploadId;if(!UploadId){return callback(util.error(new Error('no such upload id')));}ep.emit('upload_id_available',{UploadId:UploadId,PartList:[]});});});// 如果已存在 UploadId,找一个可以用的 UploadId
  1602. ep.on('has_and_check_upload_id',function(UploadIdList){// 串行地,找一个内容一致的 UploadId
  1603. UploadIdList=UploadIdList.reverse();Async.eachLimit(UploadIdList,1,function(UploadId,asyncCallback){if(!self._isRunningTask(TaskId))return;// 如果正在上传,跳过
  1604. if(session.using[UploadId]){asyncCallback();// 检查下一个 UploadId
  1605. return;}// 判断 UploadId 是否可用
  1606. wholeMultipartListPart.call(self,{Bucket:Bucket,Region:Region,Key:Key,UploadId:UploadId,tracker:params.tracker},function(err,PartListData){if(!self._isRunningTask(TaskId))return;if(err){session.removeUsing(UploadId);return ep.emit('error',err);}var PartList=PartListData.PartList;PartList.forEach(function(item){item.PartNumber*=1;item.Size*=1;item.ETag=item.ETag||'';});isAvailableUploadList(PartList,function(err,isAvailable){if(!self._isRunningTask(TaskId))return;if(err)return ep.emit('error',err);if(isAvailable){asyncCallback({UploadId:UploadId,PartList:PartList});// 马上结束
  1607. }else{asyncCallback();// 检查下一个 UploadId
  1608. }});});},function(AvailableUploadData){if(!self._isRunningTask(TaskId))return;onHashProgress(null,true);if(AvailableUploadData&&AvailableUploadData.UploadId){ep.emit('upload_id_available',AvailableUploadData);}else{ep.emit('no_available_upload_id');}});});// 在本地缓存找可用的 UploadId
  1609. ep.on('seek_local_avail_upload_id',function(RemoteUploadIdList){// 在本地找可用的 UploadId
  1610. var uuid=session.getFileId(params.Body,params.ChunkSize,Bucket,Key);var LocalUploadIdList=session.getUploadIdList.call(self,uuid);if(!uuid||!LocalUploadIdList){ep.emit('has_and_check_upload_id',RemoteUploadIdList);return;}var next=function next(index){// 如果本地找不到可用 UploadId,再一个个遍历校验远端
  1611. if(index>=LocalUploadIdList.length){ep.emit('has_and_check_upload_id',RemoteUploadIdList);return;}var UploadId=LocalUploadIdList[index];// 如果不在远端 UploadId 列表里,跳过并删除
  1612. if(!util.isInArray(RemoteUploadIdList,UploadId)){session.removeUploadId.call(self,UploadId);next(index+1);return;}// 如果正在上传,跳过
  1613. if(session.using[UploadId]){next(index+1);return;}// 判断 UploadId 是否存在线上
  1614. wholeMultipartListPart.call(self,{Bucket:Bucket,Region:Region,Key:Key,UploadId:UploadId,tracker:params.tracker},function(err,PartListData){if(!self._isRunningTask(TaskId))return;if(err){// 如果 UploadId 获取会出错,跳过并删除
  1615. session.removeUploadId.call(self,UploadId);next(index+1);}else{// 找到可用 UploadId
  1616. ep.emit('upload_id_available',{UploadId:UploadId,PartList:PartListData.PartList});}});};next(0);});// 获取线上 UploadId 列表
  1617. ep.on('get_remote_upload_id_list',function(){// 获取符合条件的 UploadId 列表,因为同一个文件可以有多个上传任务。
  1618. wholeMultipartList.call(self,{Bucket:Bucket,Region:Region,Key:Key,tracker:params.tracker},function(err,data){if(!self._isRunningTask(TaskId))return;if(err)return ep.emit('error',err);// 整理远端 UploadId 列表
  1619. var RemoteUploadIdList=util.filter(data.UploadList,function(item){return item.Key===Key&&(!StorageClass||item.StorageClass.toUpperCase()===StorageClass.toUpperCase());}).reverse().map(function(item){return item.UploadId||item.UploadID;});if(RemoteUploadIdList.length){ep.emit('seek_local_avail_upload_id',RemoteUploadIdList);}else{// 远端没有 UploadId,清理缓存的 UploadId
  1620. var uuid=session.getFileId(params.Body,params.ChunkSize,Bucket,Key),LocalUploadIdList;if(uuid&&(LocalUploadIdList=session.getUploadIdList.call(self,uuid))){util.each(LocalUploadIdList,function(UploadId){session.removeUploadId.call(self,UploadId);});}ep.emit('no_available_upload_id');}});});// 开始找可用 UploadId
  1621. ep.emit('get_remote_upload_id_list');}// 获取符合条件的全部上传任务 (条件包括 Bucket, Region, Prefix)
  1622. function wholeMultipartList(params,callback){var self=this;var UploadList=[];var sendParams={Bucket:params.Bucket,Region:params.Region,Prefix:params.Key,calledBySdk:params.calledBySdk||'sliceUploadFile',tracker:params.tracker};var next=function next(){self.multipartList(sendParams,function(err,data){if(err)return callback(err);UploadList.push.apply(UploadList,data.Upload||[]);if(data.IsTruncated==='true'){// 列表不完整
  1623. sendParams.KeyMarker=data.NextKeyMarker;sendParams.UploadIdMarker=data.NextUploadIdMarker;next();}else{callback(null,{UploadList:UploadList});}});};next();}// 获取指定上传任务的分块列表
  1624. function wholeMultipartListPart(params,callback){var self=this;var PartList=[];var sendParams={Bucket:params.Bucket,Region:params.Region,Key:params.Key,UploadId:params.UploadId,calledBySdk:'sliceUploadFile',tracker:params.tracker};var next=function next(){self.multipartListPart(sendParams,function(err,data){if(err)return callback(err);PartList.push.apply(PartList,data.Part||[]);if(data.IsTruncated==='true'){// 列表不完整
  1625. sendParams.PartNumberMarker=data.NextPartNumberMarker;next();}else{callback(null,{PartList:PartList});}});};next();}// 上传文件分块,包括
  1626. /*
  1627. UploadId (上传任务编号)
  1628. AsyncLimit (并发量),
  1629. SliceList (上传的分块数组),
  1630. FilePath (本地文件的位置),
  1631. SliceSize (文件分块大小)
  1632. FileSize (文件大小)
  1633. onProgress (上传成功之后的回调函数)
  1634. */function uploadSliceList(params,cb){var self=this;var TaskId=params.TaskId;var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var UploadData=params.UploadData;var FileSize=params.FileSize;var SliceSize=params.SliceSize;var ChunkParallel=Math.min(params.AsyncLimit||self.options.ChunkParallelLimit||1,256);var Body=params.Body;var SliceCount=Math.ceil(FileSize/SliceSize);var FinishSize=0;var ServerSideEncryption=params.ServerSideEncryption;var Headers=params.Headers;var needUploadSlices=util.filter(UploadData.PartList,function(SliceItem){if(SliceItem['Uploaded']){FinishSize+=SliceItem['PartNumber']>=SliceCount?FileSize%SliceSize||SliceSize:SliceSize;}return!SliceItem['Uploaded'];});var _onProgress2=params.onProgress;Async.eachLimit(needUploadSlices,ChunkParallel,function(SliceItem,asyncCallback){if(!self._isRunningTask(TaskId))return;var PartNumber=SliceItem['PartNumber'];var currentSize=Math.min(FileSize,SliceItem['PartNumber']*SliceSize)-(SliceItem['PartNumber']-1)*SliceSize;var preAddSize=0;uploadSliceItem.call(self,{TaskId:TaskId,Bucket:Bucket,Region:Region,Key:Key,SliceSize:SliceSize,FileSize:FileSize,PartNumber:PartNumber,ServerSideEncryption:ServerSideEncryption,Body:Body,UploadData:UploadData,Headers:Headers,onProgress:function onProgress(data){FinishSize+=data.loaded-preAddSize;preAddSize=data.loaded;_onProgress2({loaded:FinishSize,total:FileSize});},tracker:params.tracker},function(err,data){if(!self._isRunningTask(TaskId))return;if(!err&&!data.ETag)err='get ETag error, please add "ETag" to CORS ExposeHeader setting.( 获取ETag失败,请在CORS ExposeHeader设置中添加ETag,请参考文档:https://cloud.tencent.com/document/product/436/13318 )';if(err){FinishSize-=preAddSize;}else{FinishSize+=currentSize-preAddSize;SliceItem.ETag=data.ETag;}_onProgress2({loaded:FinishSize,total:FileSize});asyncCallback(err||null,data);});},function(err){if(!self._isRunningTask(TaskId))return;if(err)return cb(err);cb(null,{UploadId:UploadData.UploadId,SliceList:UploadData.PartList});});}// 上传指定分片
  1635. function uploadSliceItem(params,callback){var self=this;var TaskId=params.TaskId;var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var FileSize=params.FileSize;var FileBody=params.Body;var PartNumber=params.PartNumber*1;var SliceSize=params.SliceSize;var ServerSideEncryption=params.ServerSideEncryption;var UploadData=params.UploadData;var Headers=params.Headers||{};var ChunkRetryTimes=self.options.ChunkRetryTimes+1;var start=SliceSize*(PartNumber-1);var ContentLength=SliceSize;var end=start+SliceSize;if(end>FileSize){end=FileSize;ContentLength=end-start;}var headersWhiteList=['x-cos-traffic-limit','x-cos-mime-limit'];var headers={};util.each(Headers,function(v,k){if(headersWhiteList.indexOf(k)>-1){headers[k]=v;}});var PartItem=UploadData.PartList[PartNumber-1];Async.retry(ChunkRetryTimes,function(tryCallback){if(!self._isRunningTask(TaskId))return;util.fileSlice(FileBody,start,end,true,function(Body){self.multipartUpload({TaskId:TaskId,Bucket:Bucket,Region:Region,Key:Key,ContentLength:ContentLength,PartNumber:PartNumber,UploadId:UploadData.UploadId,ServerSideEncryption:ServerSideEncryption,Body:Body,Headers:headers,onProgress:params.onProgress,calledBySdk:'sliceUploadFile',tracker:params.tracker},function(err,data){if(!self._isRunningTask(TaskId))return;if(err)return tryCallback(err);PartItem.Uploaded=true;return tryCallback(null,data);});});},function(err,data){if(!self._isRunningTask(TaskId))return;return callback(err,data);});}// 完成分块上传
  1636. function uploadSliceComplete(params,callback){var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var UploadId=params.UploadId;var SliceList=params.SliceList;var self=this;var ChunkRetryTimes=this.options.ChunkRetryTimes+1;var Headers=params.Headers;var Parts=SliceList.map(function(item){return{PartNumber:item.PartNumber,ETag:item.ETag};});// 完成上传的请求也做重试
  1637. Async.retry(ChunkRetryTimes,function(tryCallback){self.multipartComplete({Bucket:Bucket,Region:Region,Key:Key,UploadId:UploadId,Parts:Parts,Headers:Headers,calledBySdk:'sliceUploadFile',tracker:params.tracker},tryCallback);},function(err,data){callback(err,data);});}// 抛弃分块上传任务
  1638. /*
  1639. AsyncLimit (抛弃上传任务的并发量),
  1640. UploadId (上传任务的编号,当 Level 为 task 时候需要)
  1641. Level (抛弃分块上传任务的级别,task : 抛弃指定的上传任务,file : 抛弃指定的文件对应的上传任务,其他值 :抛弃指定Bucket 的全部上传任务)
  1642. */function abortUploadTask(params,callback){var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var UploadId=params.UploadId;var Level=params.Level||'task';var AsyncLimit=params.AsyncLimit;var self=this;var ep=new EventProxy();ep.on('error',function(errData){return callback(errData);});// 已经获取到需要抛弃的任务列表
  1643. ep.on('get_abort_array',function(AbortArray){abortUploadTaskArray.call(self,{Bucket:Bucket,Region:Region,Key:Key,Headers:params.Headers,AsyncLimit:AsyncLimit,AbortArray:AbortArray},callback);});if(Level==='bucket'){// Bucket 级别的任务抛弃,抛弃该 Bucket 下的全部上传任务
  1644. wholeMultipartList.call(self,{Bucket:Bucket,Region:Region,calledBySdk:'abortUploadTask'},function(err,data){if(err)return callback(err);ep.emit('get_abort_array',data.UploadList||[]);});}else if(Level==='file'){// 文件级别的任务抛弃,抛弃该文件的全部上传任务
  1645. if(!Key)return callback(util.error(new Error('abort_upload_task_no_key')));wholeMultipartList.call(self,{Bucket:Bucket,Region:Region,Key:Key,calledBySdk:'abortUploadTask'},function(err,data){if(err)return callback(err);ep.emit('get_abort_array',data.UploadList||[]);});}else if(Level==='task'){// 单个任务级别的任务抛弃,抛弃指定 UploadId 的上传任务
  1646. if(!UploadId)return callback(util.error(new Error('abort_upload_task_no_id')));if(!Key)return callback(util.error(new Error('abort_upload_task_no_key')));ep.emit('get_abort_array',[{Key:Key,UploadId:UploadId}]);}else{return callback(util.error(new Error('abort_unknown_level')));}}// 批量抛弃分块上传任务
  1647. function abortUploadTaskArray(params,callback){var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var AbortArray=params.AbortArray;var AsyncLimit=params.AsyncLimit||1;var self=this;var index=0;var resultList=new Array(AbortArray.length);Async.eachLimit(AbortArray,AsyncLimit,function(AbortItem,nextItem){var eachIndex=index;if(Key&&Key!==AbortItem.Key){resultList[eachIndex]={error:{KeyNotMatch:true}};nextItem(null);return;}var UploadId=AbortItem.UploadId||AbortItem.UploadID;self.multipartAbort({Bucket:Bucket,Region:Region,Key:AbortItem.Key,Headers:params.Headers,UploadId:UploadId},function(err){var task={Bucket:Bucket,Region:Region,Key:AbortItem.Key,UploadId:UploadId};resultList[eachIndex]={error:err,task:task};nextItem(null);});index++;},function(err){if(err)return callback(err);var successList=[];var errorList=[];for(var i=0,len=resultList.length;i<len;i++){var item=resultList[i];if(item['task']){if(item['error']){errorList.push(item['task']);}else{successList.push(item['task']);}}}return callback(null,{successList:successList,errorList:errorList});});}// 高级上传
  1648. function uploadFile(params,callback){var self=this;// 判断多大的文件使用分片上传
  1649. var SliceSize=params.SliceSize===undefined?self.options.SliceSize:params.SliceSize;var taskList=[];var Body=params.Body;var FileSize=Body.size||Body.length||0;var fileInfo={TaskId:''};// 上传链路
  1650. if(self.options.EnableTracker){var accelerate=self.options.UseAccelerate||typeof self.options.Domain==='string'&&self.options.Domain.includes('accelerate.');params.tracker=new Tracker({bucket:params.Bucket,region:params.Region,apiName:'uploadFile',fileKey:params.Key,fileSize:FileSize,accelerate:accelerate,deepTracker:self.options.DeepTracker,customId:self.options.CustomId,delay:self.options.TrackerDelay});}// 整理 option,用于返回给回调
  1651. util.each(params,function(v,k){if(_typeof(v)!=='object'&&typeof v!=='function'){fileInfo[k]=v;}});// 处理文件 TaskReady
  1652. var _onTaskReady=params.onTaskReady;var onTaskReady=function onTaskReady(tid){fileInfo.TaskId=tid;_onTaskReady&&_onTaskReady(tid);};params.onTaskReady=onTaskReady;// 添加上传任务,超过阈值使用分块上传,小于等于则简单上传
  1653. var api=FileSize>SliceSize?'sliceUploadFile':'putObject';// 处理文件完成
  1654. var _onFileFinish=params.onFileFinish;var onFileFinish=function onFileFinish(err,data){// 格式化上报参数并上报
  1655. params.tracker&&params.tracker.formatResult(err,data);_onFileFinish&&_onFileFinish(err,data,fileInfo);callback&&callback(err,data);};taskList.push({api:api,params:params,callback:onFileFinish});self._addTasks(taskList);}// 批量上传文件
  1656. function uploadFiles(params,callback){var self=this;// 判断多大的文件使用分片上传
  1657. var SliceSize=params.SliceSize===undefined?self.options.SliceSize:params.SliceSize;// 汇总返回进度
  1658. var TotalSize=0;var TotalFinish=0;var onTotalProgress=util.throttleOnProgress.call(self,TotalFinish,params.onProgress);// 汇总返回回调
  1659. var unFinishCount=params.files.length;var _onTotalFileFinish=params.onFileFinish;var resultList=Array(unFinishCount);var onTotalFileFinish=function onTotalFileFinish(err,data,options){onTotalProgress(null,true);_onTotalFileFinish&&_onTotalFileFinish(err,data,options);resultList[options.Index]={options:options,error:err,data:data};if(--unFinishCount<=0&&callback){callback(null,{files:resultList});}};// 开始处理每个文件
  1660. var taskList=[];util.each(params.files,function(fileParams,index){(function(){// 对齐 nodejs 缩进
  1661. var Body=fileParams.Body;var FileSize=Body.size||Body.length||0;var fileInfo={Index:index,TaskId:''};// 如果 批量上传的 Key 是 / 开头,强制去掉第一个 /
  1662. if(!self.options.UseRawKey&&fileParams.Key&&fileParams.Key.substr(0,1)==='/'){fileParams.Key=fileParams.Key.substr(1);}// 更新文件总大小
  1663. TotalSize+=FileSize;// 单个文件上传链路
  1664. if(self.options.EnableTracker){var accelerate=self.options.UseAccelerate||typeof self.options.Domain==='string'&&self.options.Domain.includes('accelerate.');fileParams.tracker=new Tracker({bucket:fileParams.Bucket,region:fileParams.Region,apiName:'uploadFiles',fileKey:fileParams.Key,fileSize:FileSize,accelerate:accelerate,deepTracker:self.options.DeepTracker,customId:self.options.CustomId,delay:self.options.TrackerDelay});}// 整理 option,用于返回给回调
  1665. util.each(fileParams,function(v,k){if(_typeof(v)!=='object'&&typeof v!=='function'){fileInfo[k]=v;}});// 处理单个文件 TaskReady
  1666. var _onTaskReady=fileParams.onTaskReady;var onTaskReady=function onTaskReady(tid){fileInfo.TaskId=tid;_onTaskReady&&_onTaskReady(tid);};fileParams.onTaskReady=onTaskReady;// 处理单个文件进度
  1667. var PreAddSize=0;var _onProgress=fileParams.onProgress;var onProgress=function onProgress(info){TotalFinish=TotalFinish-PreAddSize+info.loaded;PreAddSize=info.loaded;_onProgress&&_onProgress(info);onTotalProgress({loaded:TotalFinish,total:TotalSize});};fileParams.onProgress=onProgress;// 添加上传任务
  1668. var api=FileSize>SliceSize?'sliceUploadFile':'putObject';// 处理单个文件完成
  1669. var _onFileFinish=fileParams.onFileFinish;var onFileFinish=function onFileFinish(err,data){// 格式化上报参数并上报
  1670. fileParams.tracker&&fileParams.tracker.formatResult(err,data);_onFileFinish&&_onFileFinish(err,data);onTotalFileFinish&&onTotalFileFinish(err,data,fileInfo);};taskList.push({api:api,params:fileParams,callback:onFileFinish});})();});self._addTasks(taskList);}// 分片复制文件
  1671. function sliceCopyFile(params,callback){var ep=new EventProxy();var self=this;var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var CopySource=params.CopySource;var m=util.getSourceParams.call(this,CopySource);if(!m){callback(util.error(new Error('CopySource format error')));return;}var SourceBucket=m.Bucket;var SourceRegion=m.Region;var SourceKey=decodeURIComponent(m.Key);var CopySliceSize=params.CopySliceSize===undefined?self.options.CopySliceSize:params.CopySliceSize;CopySliceSize=Math.max(0,CopySliceSize);var ChunkSize=params.CopyChunkSize||this.options.CopyChunkSize;var ChunkParallel=this.options.CopyChunkParallelLimit;var ChunkRetryTimes=this.options.ChunkRetryTimes+1;var ChunkCount=0;var FinishSize=0;var FileSize;var onProgress;var SourceResHeaders={};var SourceHeaders={};var TargetHeader={};// 分片复制完成,开始 multipartComplete 操作
  1672. ep.on('copy_slice_complete',function(UploadData){util.each(params.Headers,function(val,k){if(k.toLowerCase().indexOf('x-cos-meta-')===0);});var Parts=util.map(UploadData.PartList,function(item){return{PartNumber:item.PartNumber,ETag:item.ETag};});// 完成上传的请求也做重试
  1673. Async.retry(ChunkRetryTimes,function(tryCallback){self.multipartComplete({Bucket:Bucket,Region:Region,Key:Key,UploadId:UploadData.UploadId,Parts:Parts,calledBySdk:'sliceCopyFile'},tryCallback);},function(err,data){session.removeUsing(UploadData.UploadId);// 标记 UploadId 没被使用了,因为复制没提供重试,所以只要出错,就是 UploadId 停用了。
  1674. if(err){onProgress(null,true);return callback(err);}session.removeUploadId(UploadData.UploadId);onProgress({loaded:FileSize,total:FileSize},true);callback(null,data);});});ep.on('get_copy_data_finish',function(UploadData){// 处理 UploadId 缓存
  1675. var uuid=session.getCopyFileId(CopySource,SourceResHeaders,ChunkSize,Bucket,Key);uuid&&session.saveUploadId(uuid,UploadData.UploadId,self.options.UploadIdCacheLimit);// 缓存 UploadId
  1676. session.setUsing(UploadData.UploadId);// 标记 UploadId 为正在使用
  1677. var needCopySlices=util.filter(UploadData.PartList,function(SliceItem){if(SliceItem['Uploaded']){FinishSize+=SliceItem['PartNumber']>=ChunkCount?FileSize%ChunkSize||ChunkSize:ChunkSize;}return!SliceItem['Uploaded'];});Async.eachLimit(needCopySlices,ChunkParallel,function(SliceItem,asyncCallback){var PartNumber=SliceItem.PartNumber;var CopySourceRange=SliceItem.CopySourceRange;var currentSize=SliceItem.end-SliceItem.start;Async.retry(ChunkRetryTimes,function(tryCallback){copySliceItem.call(self,{Bucket:Bucket,Region:Region,Key:Key,CopySource:CopySource,UploadId:UploadData.UploadId,PartNumber:PartNumber,CopySourceRange:CopySourceRange},tryCallback);},function(err,data){if(err)return asyncCallback(err);FinishSize+=currentSize;onProgress({loaded:FinishSize,total:FileSize});SliceItem.ETag=data.ETag;asyncCallback(err||null,data);});},function(err){if(err){session.removeUsing(UploadData.UploadId);// 标记 UploadId 没被使用了,因为复制没提供重试,所以只要出错,就是 UploadId 停用了。
  1678. onProgress(null,true);return callback(err);}ep.emit('copy_slice_complete',UploadData);});});ep.on('get_chunk_size_finish',function(){var createNewUploadId=function createNewUploadId(){self.multipartInit({Bucket:Bucket,Region:Region,Key:Key,Headers:TargetHeader},function(err,data){if(err)return callback(err);params.UploadId=data.UploadId;ep.emit('get_copy_data_finish',{UploadId:params.UploadId,PartList:params.PartList});});};// 在本地找可用的 UploadId
  1679. var uuid=session.getCopyFileId(CopySource,SourceResHeaders,ChunkSize,Bucket,Key);var LocalUploadIdList=session.getUploadIdList(uuid);if(!uuid||!LocalUploadIdList)return createNewUploadId();var next=function next(index){// 如果本地找不到可用 UploadId,再一个个遍历校验远端
  1680. if(index>=LocalUploadIdList.length)return createNewUploadId();var UploadId=LocalUploadIdList[index];// 如果正在被使用,跳过
  1681. if(session.using[UploadId])return next(index+1);// 判断 UploadId 是否存在线上
  1682. wholeMultipartListPart.call(self,{Bucket:Bucket,Region:Region,Key:Key,UploadId:UploadId},function(err,PartListData){if(err){// 如果 UploadId 获取会出错,跳过并删除
  1683. session.removeUploadId(UploadId);next(index+1);}else{// 如果异步回来 UploadId 已经被用了,也跳过
  1684. if(session.using[UploadId])return next(index+1);// 找到可用 UploadId
  1685. var finishETagMap={};var offset=0;util.each(PartListData.PartList,function(PartItem){var size=parseInt(PartItem.Size);var end=offset+size-1;finishETagMap[PartItem.PartNumber+'|'+offset+'|'+end]=PartItem.ETag;offset+=size;});util.each(params.PartList,function(PartItem){var ETag=finishETagMap[PartItem.PartNumber+'|'+PartItem.start+'|'+PartItem.end];if(ETag){PartItem.ETag=ETag;PartItem.Uploaded=true;}});ep.emit('get_copy_data_finish',{UploadId:UploadId,PartList:params.PartList});}});};next(0);});ep.on('get_file_size_finish',function(){// 控制分片大小
  1686. (function(){var SIZE=[1,2,4,8,16,32,64,128,256,512,1024,1024*2,1024*4,1024*5];var AutoChunkSize=1024*1024;for(var i=0;i<SIZE.length;i++){AutoChunkSize=SIZE[i]*1024*1024;if(FileSize/AutoChunkSize<=self.options.MaxPartNumber)break;}params.ChunkSize=ChunkSize=Math.max(ChunkSize,AutoChunkSize);ChunkCount=Math.ceil(FileSize/ChunkSize);var list=[];for(var partNumber=1;partNumber<=ChunkCount;partNumber++){var start=(partNumber-1)*ChunkSize;var end=partNumber*ChunkSize<FileSize?partNumber*ChunkSize-1:FileSize-1;var item={PartNumber:partNumber,start:start,end:end,CopySourceRange:'bytes='+start+'-'+end};list.push(item);}params.PartList=list;})();if(params.Headers['x-cos-metadata-directive']==='Replaced'){TargetHeader=params.Headers;}else{TargetHeader=SourceHeaders;}TargetHeader['x-cos-storage-class']=params.Headers['x-cos-storage-class']||SourceHeaders['x-cos-storage-class'];TargetHeader=util.clearKey(TargetHeader);/**
  1687. * 对于归档存储的对象,如果未恢复副本,则不允许 Copy
  1688. */if(SourceHeaders['x-cos-storage-class']==='ARCHIVE'||SourceHeaders['x-cos-storage-class']==='DEEP_ARCHIVE'){var restoreHeader=SourceHeaders['x-cos-restore'];if(!restoreHeader||restoreHeader==='ongoing-request="true"'){callback(util.error(new Error('Unrestored archive object is not allowed to be copied')));return;}}/**
  1689. * 去除一些无用的头部,规避 multipartInit 出错
  1690. * 这些头部通常是在 putObjectCopy 时才使用
  1691. */delete TargetHeader['x-cos-copy-source'];delete TargetHeader['x-cos-metadata-directive'];delete TargetHeader['x-cos-copy-source-If-Modified-Since'];delete TargetHeader['x-cos-copy-source-If-Unmodified-Since'];delete TargetHeader['x-cos-copy-source-If-Match'];delete TargetHeader['x-cos-copy-source-If-None-Match'];ep.emit('get_chunk_size_finish');});// 获取远端复制源文件的大小
  1692. self.headObject({Bucket:SourceBucket,Region:SourceRegion,Key:SourceKey},function(err,data){if(err){if(err.statusCode&&err.statusCode===404){callback(util.error(err,{ErrorStatus:SourceKey+' Not Exist'}));}else{callback(err);}return;}FileSize=params.FileSize=data.headers['content-length'];if(FileSize===undefined||!FileSize){callback(util.error(new Error('get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.( 获取Content-Length失败,请在CORS ExposeHeader设置中添加Content-Length,请参考文档:https://cloud.tencent.com/document/product/436/13318 )')));return;}onProgress=util.throttleOnProgress.call(self,FileSize,params.onProgress);// 开始上传
  1693. if(FileSize<=CopySliceSize){if(!params.Headers['x-cos-metadata-directive']){params.Headers['x-cos-metadata-directive']='Copy';}self.putObjectCopy(params,function(err,data){if(err){onProgress(null,true);return callback(err);}onProgress({loaded:FileSize,total:FileSize},true);callback(err,data);});}else{var resHeaders=data.headers;SourceResHeaders=resHeaders;SourceHeaders={'Cache-Control':resHeaders['cache-control'],'Content-Disposition':resHeaders['content-disposition'],'Content-Encoding':resHeaders['content-encoding'],'Content-Type':resHeaders['content-type'],Expires:resHeaders['expires'],'x-cos-storage-class':resHeaders['x-cos-storage-class']};util.each(resHeaders,function(v,k){var metaPrefix='x-cos-meta-';if(k.indexOf(metaPrefix)===0&&k.length>metaPrefix.length){SourceHeaders[k]=v;}});ep.emit('get_file_size_finish');}});}// 复制指定分片
  1694. function copySliceItem(params,callback){var TaskId=params.TaskId;var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var CopySource=params.CopySource;var UploadId=params.UploadId;var PartNumber=params.PartNumber*1;var CopySourceRange=params.CopySourceRange;var ChunkRetryTimes=this.options.ChunkRetryTimes+1;var self=this;Async.retry(ChunkRetryTimes,function(tryCallback){self.uploadPartCopy({TaskId:TaskId,Bucket:Bucket,Region:Region,Key:Key,CopySource:CopySource,UploadId:UploadId,PartNumber:PartNumber,CopySourceRange:CopySourceRange},function(err,data){tryCallback(err||null,data);});},function(err,data){return callback(err,data);});}var API_MAP={sliceUploadFile:sliceUploadFile,abortUploadTask:abortUploadTask,uploadFile:uploadFile,uploadFiles:uploadFiles,sliceCopyFile:sliceCopyFile};module.exports.init=function(COS,task){task.transferToTaskMethod(API_MAP,'sliceUploadFile');util.each(API_MAP,function(fn,apiName){COS.prototype[apiName]=util.apiWrapper(apiName,fn);});};/***/},/***/"./src/async.js":/*!**********************!*\
  1695. !*** ./src/async.js ***!
  1696. \**********************/ /*! no static exports found */ /***/function srcAsyncJs(module,exports){var eachLimit=function eachLimit(arr,limit,iterator,callback){callback=callback||function(){};if(!arr.length||limit<=0){return callback();}var completed=0;var started=0;var running=0;(function replenish(){if(completed>=arr.length){return callback();}while(running<limit&&started<arr.length){started+=1;running+=1;iterator(arr[started-1],function(err){if(err){callback(err);callback=function callback(){};}else{completed+=1;running-=1;if(completed>=arr.length){callback();}else{replenish();}}});}})();};var retry=function retry(times,iterator,callback){var next=function next(index){iterator(function(err,data){if(err&&index<times){next(index+1);}else{callback(err,data);}});};if(times<1){callback();}else{next(1);}};var async={eachLimit:eachLimit,retry:retry};module.exports=async;/***/},/***/"./src/base.js":/*!*********************!*\
  1697. !*** ./src/base.js ***!
  1698. \*********************/ /*! no static exports found */ /***/function srcBaseJs(module,exports,__webpack_require__){var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");var REQUEST=__webpack_require__(/*! ../lib/request */"./lib/request.js");var util=__webpack_require__(/*! ./util */"./src/util.js");// Bucket 相关
  1699. /**
  1700. * 获取用户的 bucket 列表
  1701. * @param {Object} params 回调函数,必须,下面为参数列表
  1702. * 无特殊参数
  1703. * @param {Function} callback 回调函数,必须
  1704. */function getService(params,callback){if(typeof params==='function'){callback=params;params={};}var protocol=this.options.Protocol||(util.isBrowser&&(typeof location==="undefined"?"undefined":_typeof(location))==='object'&&location.protocol==='http:'?'http:':'https:');var domain=this.options.ServiceDomain;var appId=params.AppId||this.options.appId;var region=params.Region;if(domain){domain=domain.replace(/\{\{AppId\}\}/gi,appId||'').replace(/\{\{Region\}\}/gi,region||'').replace(/\{\{.*?\}\}/gi,'');if(!/^[a-zA-Z]+:\/\//.test(domain)){domain=protocol+'//'+domain;}if(domain.slice(-1)==='/'){domain=domain.slice(0,-1);}}else if(region){domain=protocol+'//cos.'+region+'.myqcloud.com';}else{domain=protocol+'//service.cos.myqcloud.com';}var SignHost='';var standardHost=region?'cos.'+region+'.myqcloud.com':'service.cos.myqcloud.com';var urlHost=domain.replace(/^https?:\/\/([^/]+)(\/.*)?$/,'$1');if(standardHost===urlHost)SignHost=standardHost;submitRequest.call(this,{Action:'name/cos:GetService',url:domain,method:'GET',headers:params.Headers,SignHost:SignHost},function(err,data){if(err)return callback(err);var buckets=data&&data.ListAllMyBucketsResult&&data.ListAllMyBucketsResult.Buckets&&data.ListAllMyBucketsResult.Buckets.Bucket||[];buckets=util.isArray(buckets)?buckets:[buckets];var owner=data&&data.ListAllMyBucketsResult&&data.ListAllMyBucketsResult.Owner||{};callback(null,{Buckets:buckets,Owner:owner,statusCode:data.statusCode,headers:data.headers});});}/**
  1705. * 创建 Bucket,并初始化访问权限
  1706. * @param {Object} params 参数对象,必须
  1707. * @param {String} params.Bucket Bucket名称,必须
  1708. * @param {String} params.Region 地域名称,必须
  1709. * @param {String} params.ACL 用户自定义文件权限,可以设置:private,public-read;默认值:private,非必须
  1710. * @param {String} params.GrantRead 赋予被授权者读的权限,格式x-cos-grant-read: uin=" ",uin=" ",非必须
  1711. * @param {String} params.GrantWrite 赋予被授权者写的权限,格式x-cos-grant-write: uin=" ",uin=" ",非必须
  1712. * @param {String} params.GrantFullControl 赋予被授权者读写权限,格式x-cos-grant-full-control: uin=" ",uin=" ",非必须
  1713. * @param {Function} callback 回调函数,必须
  1714. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1715. * @return {Object} data 返回的数据
  1716. * @return {String} data.Location 操作地址
  1717. */function putBucket(params,callback){var self=this;var xml='';if(params['BucketAZConfig']){var CreateBucketConfiguration={BucketAZConfig:params.BucketAZConfig};xml=util.json2xml({CreateBucketConfiguration:CreateBucketConfiguration});}submitRequest.call(this,{Action:'name/cos:PutBucket',method:'PUT',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,body:xml},function(err,data){if(err)return callback(err);var url=getUrl({protocol:self.options.Protocol,domain:self.options.Domain,bucket:params.Bucket,region:params.Region,isLocation:true});callback(null,{Location:url,statusCode:data.statusCode,headers:data.headers});});}/**
  1718. * 查看是否存在该Bucket,是否有权限访问
  1719. * @param {Object} params 参数对象,必须
  1720. * @param {String} params.Bucket Bucket名称,必须
  1721. * @param {String} params.Region 地域名称,必须
  1722. * @param {Function} callback 回调函数,必须
  1723. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1724. * @return {Object} data 返回的数据
  1725. * @return {Boolean} data.BucketExist Bucket是否存在
  1726. * @return {Boolean} data.BucketAuth 是否有 Bucket 的访问权限
  1727. */function headBucket(params,callback){submitRequest.call(this,{Action:'name/cos:HeadBucket',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,method:'HEAD'},callback);}/**
  1728. * 获取 Bucket 下的 object 列表
  1729. * @param {Object} params 参数对象,必须
  1730. * @param {String} params.Bucket Bucket名称,必须
  1731. * @param {String} params.Region 地域名称,必须
  1732. * @param {String} params.Prefix 前缀匹配,用来规定返回的文件前缀地址,非必须
  1733. * @param {String} params.Delimiter 定界符为一个符号,如果有Prefix,则将Prefix到delimiter之间的相同路径归为一类,非必须
  1734. * @param {String} params.Marker 默认以UTF-8二进制顺序列出条目,所有列出条目从marker开始,非必须
  1735. * @param {String} params.MaxKeys 单次返回最大的条目数量,默认1000,非必须
  1736. * @param {String} params.EncodingType 规定返回值的编码方式,非必须
  1737. * @param {Function} callback 回调函数,必须
  1738. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1739. * @return {Object} data 返回的数据
  1740. * @return {Object} data.ListBucketResult 返回的 object 列表信息
  1741. */function getBucket(params,callback){var reqParams={};reqParams['prefix']=params['Prefix']||'';reqParams['delimiter']=params['Delimiter'];reqParams['marker']=params['Marker'];reqParams['max-keys']=params['MaxKeys'];reqParams['encoding-type']=params['EncodingType'];submitRequest.call(this,{Action:'name/cos:GetBucket',ResourceKey:reqParams['prefix'],method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,qs:reqParams},function(err,data){if(err)return callback(err);var ListBucketResult=data.ListBucketResult||{};var Contents=ListBucketResult.Contents||[];var CommonPrefixes=ListBucketResult.CommonPrefixes||[];Contents=util.isArray(Contents)?Contents:[Contents];CommonPrefixes=util.isArray(CommonPrefixes)?CommonPrefixes:[CommonPrefixes];var result=util.clone(ListBucketResult);util.extend(result,{Contents:Contents,CommonPrefixes:CommonPrefixes,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  1742. * 删除 Bucket
  1743. * @param {Object} params 参数对象,必须
  1744. * @param {String} params.Bucket Bucket名称,必须
  1745. * @param {String} params.Region 地域名称,必须
  1746. * @param {Function} callback 回调函数,必须
  1747. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1748. * @return {Object} data 返回的数据
  1749. * @return {String} data.Location 操作地址
  1750. */function deleteBucket(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucket',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,method:'DELETE'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1751. * 设置 Bucket 的 权限列表
  1752. * @param {Object} params 参数对象,必须
  1753. * @param {String} params.Bucket Bucket名称,必须
  1754. * @param {String} params.Region 地域名称,必须
  1755. * @param {String} params.ACL 用户自定义文件权限,可以设置:private,public-read;默认值:private,非必须
  1756. * @param {String} params.GrantRead 赋予被授权者读的权限,格式x-cos-grant-read: uin=" ",uin=" ",非必须
  1757. * @param {String} params.GrantWrite 赋予被授权者写的权限,格式x-cos-grant-write: uin=" ",uin=" ",非必须
  1758. * @param {String} params.GrantFullControl 赋予被授权者读写权限,格式x-cos-grant-full-control: uin=" ",uin=" ",非必须
  1759. * @param {Function} callback 回调函数,必须
  1760. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1761. * @return {Object} data 返回的数据
  1762. */function putBucketAcl(params,callback){var headers=params.Headers;var xml='';if(params['AccessControlPolicy']){var AccessControlPolicy=util.clone(params['AccessControlPolicy']||{});var Grants=AccessControlPolicy.Grants||AccessControlPolicy.Grant;Grants=util.isArray(Grants)?Grants:[Grants];delete AccessControlPolicy.Grant;delete AccessControlPolicy.Grants;AccessControlPolicy.AccessControlList={Grant:Grants};xml=util.json2xml({AccessControlPolicy:AccessControlPolicy});headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));}// Grant Header 去重
  1763. util.each(headers,function(val,key){if(key.indexOf('x-cos-grant-')===0){headers[key]=uniqGrant(headers[key]);}});submitRequest.call(this,{Action:'name/cos:PutBucketACL',method:'PUT',Bucket:params.Bucket,Region:params.Region,headers:headers,action:'acl',body:xml},function(err,data){if(err)return callback(err);callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1764. * 获取 Bucket 的 权限列表
  1765. * @param {Object} params 参数对象,必须
  1766. * @param {String} params.Bucket Bucket名称,必须
  1767. * @param {String} params.Region 地域名称,必须
  1768. * @param {Function} callback 回调函数,必须
  1769. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1770. * @return {Object} data 返回的数据
  1771. * @return {Object} data.AccessControlPolicy 访问权限信息
  1772. */function getBucketAcl(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketACL',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'acl'},function(err,data){if(err)return callback(err);var AccessControlPolicy=data.AccessControlPolicy||{};var Owner=AccessControlPolicy.Owner||{};var Grant=AccessControlPolicy.AccessControlList.Grant||[];Grant=util.isArray(Grant)?Grant:[Grant];var result=decodeAcl(AccessControlPolicy);if(data.headers&&data.headers['x-cos-acl']){result.ACL=data.headers['x-cos-acl'];}result=util.extend(result,{Owner:Owner,Grants:Grant,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  1773. * 设置 Bucket 的 跨域设置
  1774. * @param {Object} params 参数对象,必须
  1775. * @param {String} params.Bucket Bucket名称,必须
  1776. * @param {String} params.Region 地域名称,必须
  1777. * @param {Object} params.CORSConfiguration 相关的跨域设置,必须
  1778. * @param {Array} params.CORSConfiguration.CORSRules 对应的跨域规则
  1779. * @param {Function} callback 回调函数,必须
  1780. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1781. * @return {Object} data 返回的数据
  1782. */function putBucketCors(params,callback){var CORSConfiguration=params['CORSConfiguration']||{};var CORSRules=CORSConfiguration['CORSRules']||params['CORSRules']||[];CORSRules=util.clone(util.isArray(CORSRules)?CORSRules:[CORSRules]);util.each(CORSRules,function(rule){util.each(['AllowedOrigin','AllowedHeader','AllowedMethod','ExposeHeader'],function(key){var sKey=key+'s';var val=rule[sKey]||rule[key]||[];delete rule[sKey];rule[key]=util.isArray(val)?val:[val];});});var Conf={CORSRule:CORSRules};if(params.ResponseVary)Conf.ResponseVary=params.ResponseVary;var xml=util.json2xml({CORSConfiguration:Conf});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketCORS',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'cors',headers:headers},function(err,data){if(err)return callback(err);callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1783. * 获取 Bucket 的 跨域设置
  1784. * @param {Object} params 参数对象,必须
  1785. * @param {String} params.Bucket Bucket名称,必须
  1786. * @param {String} params.Region 地域名称,必须
  1787. * @param {Function} callback 回调函数,必须
  1788. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1789. * @return {Object} data 返回的数据
  1790. * @return {Object} data.CORSRules Bucket的跨域设置
  1791. */function getBucketCors(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketCORS',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'cors'},function(err,data){if(err){if(err.statusCode===404&&err.error&&err.error.Code==='NoSuchCORSConfiguration'){var result={CORSRules:[],statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var CORSConfiguration=data.CORSConfiguration||{};var CORSRules=CORSConfiguration.CORSRules||CORSConfiguration.CORSRule||[];CORSRules=util.clone(util.isArray(CORSRules)?CORSRules:[CORSRules]);var ResponseVary=CORSConfiguration.ResponseVary;util.each(CORSRules,function(rule){util.each(['AllowedOrigin','AllowedHeader','AllowedMethod','ExposeHeader'],function(key){var sKey=key+'s';var val=rule[sKey]||rule[key]||[];delete rule[key];rule[sKey]=util.isArray(val)?val:[val];});});callback(null,{CORSRules:CORSRules,ResponseVary:ResponseVary,statusCode:data.statusCode,headers:data.headers});});}/**
  1792. * 删除 Bucket 的 跨域设置
  1793. * @param {Object} params 参数对象,必须
  1794. * @param {String} params.Bucket Bucket名称,必须
  1795. * @param {String} params.Region 地域名称,必须
  1796. * @param {Function} callback 回调函数,必须
  1797. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1798. * @return {Object} data 返回的数据
  1799. */function deleteBucketCors(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketCORS',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'cors'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode||err.statusCode,headers:data.headers});});}/**
  1800. * 获取 Bucket 的 地域信息
  1801. * @param {Object} params 参数对象,必须
  1802. * @param {String} params.Bucket Bucket名称,必须
  1803. * @param {String} params.Region 地域名称,必须
  1804. * @param {Function} callback 回调函数,必须
  1805. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1806. * @return {Object} data 返回数据,包含地域信息 LocationConstraint
  1807. */function getBucketLocation(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketLocation',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'location'},callback);}function putBucketPolicy(params,callback){var Policy=params['Policy'];try{if(typeof Policy==='string')Policy=JSON.parse(Policy);}catch(e){}if(!Policy||typeof Policy==='string')return callback(util.error(new Error('Policy format error')));var PolicyStr=JSON.stringify(Policy);if(!Policy.version)Policy.version='2.0';var headers=params.Headers;headers['Content-Type']='application/json';headers['Content-MD5']=util.b64(util.md5(PolicyStr));submitRequest.call(this,{Action:'name/cos:PutBucketPolicy',method:'PUT',Bucket:params.Bucket,Region:params.Region,action:'policy',body:PolicyStr,headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1808. * 获取 Bucket 的读取权限策略
  1809. * @param {Object} params 参数对象,必须
  1810. * @param {String} params.Bucket Bucket名称,必须
  1811. * @param {String} params.Region 地域名称,必须
  1812. * @param {Function} callback 回调函数,必须
  1813. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1814. * @return {Object} data 返回数据
  1815. */function getBucketPolicy(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketPolicy',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'policy',rawBody:true},function(err,data){if(err){if(err.statusCode&&err.statusCode===403){return callback(util.error(err,{ErrorStatus:'Access Denied'}));}if(err.statusCode&&err.statusCode===405){return callback(util.error(err,{ErrorStatus:'Method Not Allowed'}));}if(err.statusCode&&err.statusCode===404){return callback(util.error(err,{ErrorStatus:'Policy Not Found'}));}return callback(err);}var Policy={};try{Policy=JSON.parse(data.body);}catch(e){}callback(null,{Policy:Policy,statusCode:data.statusCode,headers:data.headers});});}/**
  1816. * 删除 Bucket 的 跨域设置
  1817. * @param {Object} params 参数对象,必须
  1818. * @param {String} params.Bucket Bucket名称,必须
  1819. * @param {String} params.Region 地域名称,必须
  1820. * @param {Function} callback 回调函数,必须
  1821. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1822. * @return {Object} data 返回的数据
  1823. */function deleteBucketPolicy(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketPolicy',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'policy'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode||err.statusCode,headers:data.headers});});}/**
  1824. * 设置 Bucket 的标签
  1825. * @param {Object} params 参数对象,必须
  1826. * @param {String} params.Bucket Bucket名称,必须
  1827. * @param {String} params.Region 地域名称,必须
  1828. * @param {Array} params.TagSet 标签设置,必须
  1829. * @param {Function} callback 回调函数,必须
  1830. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1831. * @return {Object} data 返回数据
  1832. */function putBucketTagging(params,callback){var Tagging=params['Tagging']||{};var Tags=Tagging.TagSet||Tagging.Tags||params['Tags']||[];Tags=util.clone(util.isArray(Tags)?Tags:[Tags]);var xml=util.json2xml({Tagging:{TagSet:{Tag:Tags}}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketTagging',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'tagging',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1833. * 获取 Bucket 的标签设置
  1834. * @param {Object} params 参数对象,必须
  1835. * @param {String} params.Bucket Bucket名称,必须
  1836. * @param {String} params.Region 地域名称,必须
  1837. * @param {Function} callback 回调函数,必须
  1838. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1839. * @return {Object} data 返回数据
  1840. */function getBucketTagging(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketTagging',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'tagging'},function(err,data){if(err){if(err.statusCode===404&&err.error&&(err.error==='Not Found'||err.error.Code==='NoSuchTagSet')){var result={Tags:[],statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var Tags=[];try{Tags=data.Tagging.TagSet.Tag||[];}catch(e){}Tags=util.clone(util.isArray(Tags)?Tags:[Tags]);callback(null,{Tags:Tags,statusCode:data.statusCode,headers:data.headers});});}/**
  1841. * 删除 Bucket 的 标签设置
  1842. * @param {Object} params 参数对象,必须
  1843. * @param {String} params.Bucket Bucket名称,必须
  1844. * @param {String} params.Region 地域名称,必须
  1845. * @param {Function} callback 回调函数,必须
  1846. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1847. * @return {Object} data 返回的数据
  1848. */function deleteBucketTagging(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketTagging',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'tagging'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}function putBucketLifecycle(params,callback){var LifecycleConfiguration=params['LifecycleConfiguration']||{};var Rules=LifecycleConfiguration.Rules||params.Rules||[];Rules=util.clone(Rules);var xml=util.json2xml({LifecycleConfiguration:{Rule:Rules}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketLifecycle',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'lifecycle',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}function getBucketLifecycle(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketLifecycle',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'lifecycle'},function(err,data){if(err){if(err.statusCode===404&&err.error&&err.error.Code==='NoSuchLifecycleConfiguration'){var result={Rules:[],statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var Rules=[];try{Rules=data.LifecycleConfiguration.Rule||[];}catch(e){}Rules=util.clone(util.isArray(Rules)?Rules:[Rules]);callback(null,{Rules:Rules,statusCode:data.statusCode,headers:data.headers});});}function deleteBucketLifecycle(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketLifecycle',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'lifecycle'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}function putBucketVersioning(params,callback){if(!params['VersioningConfiguration']){callback(util.error(new Error('missing param VersioningConfiguration')));return;}var VersioningConfiguration=params['VersioningConfiguration']||{};var xml=util.json2xml({VersioningConfiguration:VersioningConfiguration});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketVersioning',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'versioning',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}function getBucketVersioning(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketVersioning',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'versioning'},function(err,data){if(!err){!data.VersioningConfiguration&&(data.VersioningConfiguration={});}callback(err,data);});}function putBucketReplication(params,callback){var ReplicationConfiguration=util.clone(params.ReplicationConfiguration);var xml=util.json2xml({ReplicationConfiguration:ReplicationConfiguration});xml=xml.replace(/<(\/?)Rules>/gi,'<$1Rule>');xml=xml.replace(/<(\/?)Tags>/gi,'<$1Tag>');var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketReplication',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'replication',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}function getBucketReplication(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketReplication',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'replication'},function(err,data){if(err){if(err.statusCode===404&&err.error&&(err.error==='Not Found'||err.error.Code==='ReplicationConfigurationnotFoundError')){var result={ReplicationConfiguration:{Rules:[]},statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}!data.ReplicationConfiguration&&(data.ReplicationConfiguration={});if(data.ReplicationConfiguration.Rule){data.ReplicationConfiguration.Rules=util.makeArray(data.ReplicationConfiguration.Rule);delete data.ReplicationConfiguration.Rule;}callback(err,data);});}function deleteBucketReplication(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketReplication',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'replication'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1849. * 设置 Bucket 静态网站配置信息
  1850. * @param {Object} params 参数对象,必须
  1851. * @param {String} params.Bucket Bucket名称,必须
  1852. * @param {String} params.Region 地域名称,必须
  1853. * @param {Object} params.WebsiteConfiguration 地域名称,必须
  1854. * @param {Object} WebsiteConfiguration.IndexDocument 索引文档,必须
  1855. * @param {Object} WebsiteConfiguration.ErrorDocument 错误文档,非必须
  1856. * @param {Object} WebsiteConfiguration.RedirectAllRequestsTo 重定向所有请求,非必须
  1857. * @param {Array} params.RoutingRules 重定向规则,非必须
  1858. * @param {Function} callback 回调函数,必须
  1859. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1860. * @return {Object} data 返回数据
  1861. */function putBucketWebsite(params,callback){if(!params['WebsiteConfiguration']){callback(util.error(new Error('missing param WebsiteConfiguration')));return;}var WebsiteConfiguration=util.clone(params['WebsiteConfiguration']||{});var RoutingRules=WebsiteConfiguration['RoutingRules']||WebsiteConfiguration['RoutingRule']||[];RoutingRules=util.isArray(RoutingRules)?RoutingRules:[RoutingRules];delete WebsiteConfiguration.RoutingRule;delete WebsiteConfiguration.RoutingRules;if(RoutingRules.length)WebsiteConfiguration.RoutingRules={RoutingRule:RoutingRules};var xml=util.json2xml({WebsiteConfiguration:WebsiteConfiguration});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketWebsite',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'website',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1862. * 获取 Bucket 的静态网站配置信息
  1863. * @param {Object} params 参数对象,必须
  1864. * @param {String} params.Bucket Bucket名称,必须
  1865. * @param {String} params.Region 地域名称,必须
  1866. * @param {Function} callback 回调函数,必须
  1867. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1868. * @return {Object} data 返回数据
  1869. */function getBucketWebsite(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketWebsite',method:'GET',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,action:'website'},function(err,data){if(err){if(err.statusCode===404&&err.error.Code==='NoSuchWebsiteConfiguration'){var result={WebsiteConfiguration:{},statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var WebsiteConfiguration=data.WebsiteConfiguration||{};if(WebsiteConfiguration['RoutingRules']){var RoutingRules=util.clone(WebsiteConfiguration['RoutingRules'].RoutingRule||[]);RoutingRules=util.makeArray(RoutingRules);WebsiteConfiguration.RoutingRules=RoutingRules;}callback(null,{WebsiteConfiguration:WebsiteConfiguration,statusCode:data.statusCode,headers:data.headers});});}/**
  1870. * 删除 Bucket 的静态网站配置
  1871. * @param {Object} params 参数对象,必须
  1872. * @param {String} params.Bucket Bucket名称,必须
  1873. * @param {String} params.Region 地域名称,必须
  1874. * @param {Function} callback 回调函数,必须
  1875. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1876. * @return {Object} data 返回数据
  1877. */function deleteBucketWebsite(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketWebsite',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'website'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1878. * 设置 Bucket 的防盗链白名单或者黑名单
  1879. * @param {Object} params 参数对象,必须
  1880. * @param {String} params.Bucket Bucket名称,必须
  1881. * @param {String} params.Region 地域名称,必须
  1882. * @param {Object} params.RefererConfiguration 地域名称,必须
  1883. * @param {String} RefererConfiguration.Status 是否开启防盗链,枚举值:Enabled、Disabled
  1884. * @param {String} RefererConfiguration.RefererType 防盗链类型,枚举值:Black-List、White-List,必须
  1885. * @param {Array} RefererConfiguration.DomianList.Domain 生效域名,必须
  1886. * @param {String} RefererConfiguration.EmptyReferConfiguration ,非必须
  1887. * @param {Function} callback 回调函数,必须
  1888. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1889. * @return {Object} data 返回数据
  1890. */function putBucketReferer(params,callback){if(!params['RefererConfiguration']){callback(util.error(new Error('missing param RefererConfiguration')));return;}var RefererConfiguration=util.clone(params['RefererConfiguration']||{});var DomainList=RefererConfiguration['DomainList']||{};var Domains=DomainList['Domains']||DomainList['Domain']||[];Domains=util.isArray(Domains)?Domains:[Domains];if(Domains.length)RefererConfiguration.DomainList={Domain:Domains};var xml=util.json2xml({RefererConfiguration:RefererConfiguration});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketReferer',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'referer',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1891. * 获取 Bucket 的防盗链白名单或者黑名单
  1892. * @param {Object} params 参数对象,必须
  1893. * @param {String} params.Bucket Bucket名称,必须
  1894. * @param {String} params.Region 地域名称,必须
  1895. * @param {Function} callback 回调函数,必须
  1896. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1897. * @return {Object} data 返回数据
  1898. */function getBucketReferer(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketReferer',method:'GET',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,action:'referer'},function(err,data){if(err){if(err.statusCode===404&&err.error.Code==='NoSuchRefererConfiguration'){var result={WebsiteConfiguration:{},statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var RefererConfiguration=data.RefererConfiguration||{};if(RefererConfiguration['DomainList']){var Domains=util.makeArray(RefererConfiguration['DomainList'].Domain||[]);RefererConfiguration.DomainList={Domains:Domains};}callback(null,{RefererConfiguration:RefererConfiguration,statusCode:data.statusCode,headers:data.headers});});}/**
  1899. * 设置 Bucket 自定义域名
  1900. * @param {Object} params 参数对象,必须
  1901. * @param {String} params.Bucket Bucket名称,必须
  1902. * @param {String} params.Region 地域名称,必须
  1903. * @param {Function} callback 回调函数,必须
  1904. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1905. * @return {Object} data 返回数据
  1906. */function putBucketDomain(params,callback){var DomainConfiguration=params['DomainConfiguration']||{};var DomainRule=DomainConfiguration.DomainRule||params.DomainRule||[];DomainRule=util.clone(DomainRule);var xml=util.json2xml({DomainConfiguration:{DomainRule:DomainRule}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketDomain',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'domain',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1907. * 获取 Bucket 的自定义域名
  1908. * @param {Object} params 参数对象,必须
  1909. * @param {String} params.Bucket Bucket名称,必须
  1910. * @param {String} params.Region 地域名称,必须
  1911. * @param {Function} callback 回调函数,必须
  1912. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1913. * @return {Object} data 返回数据
  1914. */function getBucketDomain(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketDomain',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'domain'},function(err,data){if(err)return callback(err);var DomainRule=[];try{DomainRule=data.DomainConfiguration.DomainRule||[];}catch(e){}DomainRule=util.clone(util.isArray(DomainRule)?DomainRule:[DomainRule]);callback(null,{DomainRule:DomainRule,statusCode:data.statusCode,headers:data.headers});});}/**
  1915. * 删除 Bucket 自定义域名
  1916. * @param {Object} params 参数对象,必须
  1917. * @param {String} params.Bucket Bucket名称,必须
  1918. * @param {String} params.Region 地域名称,必须
  1919. * @param {Function} callback 回调函数,必须
  1920. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1921. * @return {Object} data 返回数据
  1922. */function deleteBucketDomain(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketDomain',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'domain'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1923. * 设置 Bucket 的回源
  1924. * @param {Object} params 参数对象,必须
  1925. * @param {String} params.Bucket Bucket名称,必须
  1926. * @param {String} params.Region 地域名称,必须
  1927. * @param {Function} callback 回调函数,必须
  1928. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1929. * @return {Object} data 返回数据
  1930. */function putBucketOrigin(params,callback){var OriginConfiguration=params['OriginConfiguration']||{};var OriginRule=OriginConfiguration.OriginRule||params.OriginRule||[];OriginRule=util.clone(OriginRule);var xml=util.json2xml({OriginConfiguration:{OriginRule:OriginRule}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketOrigin',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'origin',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1931. * 获取 Bucket 的回源
  1932. * @param {Object} params 参数对象,必须
  1933. * @param {String} params.Bucket Bucket名称,必须
  1934. * @param {String} params.Region 地域名称,必须
  1935. * @param {Function} callback 回调函数,必须
  1936. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1937. * @return {Object} data 返回数据
  1938. */function getBucketOrigin(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketOrigin',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'origin'},function(err,data){if(err)return callback(err);var OriginRule=[];try{OriginRule=data.OriginConfiguration.OriginRule||[];}catch(e){}OriginRule=util.clone(util.isArray(OriginRule)?OriginRule:[OriginRule]);callback(null,{OriginRule:OriginRule,statusCode:data.statusCode,headers:data.headers});});}/**
  1939. * 删除 Bucket 的回源
  1940. * @param {Object} params 参数对象,必须
  1941. * @param {String} params.Bucket Bucket名称,必须
  1942. * @param {String} params.Region 地域名称,必须
  1943. * @param {Function} callback 回调函数,必须
  1944. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1945. * @return {Object} data 返回数据
  1946. */function deleteBucketOrigin(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketOrigin',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'origin'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1947. * 设置 Bucket 的日志记录
  1948. * @param {Object} params 参数对象,必须
  1949. * @param {String} params.Bucket Bucket名称,必须
  1950. * @param {String} params.Region 地域名称,必须
  1951. * @param {(Object|String)} params.BucketLoggingStatus 说明日志记录配置的状态,如果无子节点信息则意为关闭日志记录,必须
  1952. * @param {Function} callback 回调函数,必须
  1953. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1954. * @return {Object} data 返回数据
  1955. */function putBucketLogging(params,callback){var xml=util.json2xml({BucketLoggingStatus:params['BucketLoggingStatus']||''});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketLogging',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'logging',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1956. * 获取 Bucket 的日志记录
  1957. * @param {Object} params 参数对象,必须
  1958. * @param {String} params.Bucket Bucket名称,必须
  1959. * @param {String} params.Region 地域名称,必须
  1960. * @param {Function} callback 回调函数,必须
  1961. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1962. * @return {Object} data 返回数据
  1963. */function getBucketLogging(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketLogging',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'logging'},function(err,data){if(err)return callback(err);callback(null,{BucketLoggingStatus:data.BucketLoggingStatus,statusCode:data.statusCode,headers:data.headers});});}/**
  1964. * 创建/编辑 Bucket 的清单任务
  1965. * @param {Object} params 参数对象,必须
  1966. * @param {String} params.Bucket Bucket名称,必须
  1967. * @param {String} params.Region 地域名称,必须
  1968. * @param {String} params.Id 清单任务的名称,必须
  1969. * @param {Object} params.InventoryConfiguration 包含清单的配置参数,必须
  1970. * @param {Function} callback 回调函数,必须
  1971. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1972. * @return {Object} data 返回数据
  1973. */function submitBucketInventory(method,params,callback){var InventoryConfiguration=util.clone(params['InventoryConfiguration']);if(InventoryConfiguration.OptionalFields){var Field=InventoryConfiguration.OptionalFields||[];InventoryConfiguration.OptionalFields={Field:Field};}if(InventoryConfiguration.Destination&&InventoryConfiguration.Destination.COSBucketDestination&&InventoryConfiguration.Destination.COSBucketDestination.Encryption){var Encryption=InventoryConfiguration.Destination.COSBucketDestination.Encryption;if(Object.keys(Encryption).indexOf('SSECOS')>-1){Encryption['SSE-COS']=Encryption['SSECOS'];delete Encryption['SSECOS'];}}var xml=util.json2xml({InventoryConfiguration:InventoryConfiguration});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));var action=method==='PUT'?'name/cos:PutBucketInventory':'name/cos:PostBucketInventory';submitRequest.call(this,{Action:action,method:method,Bucket:params.Bucket,Region:params.Region,body:xml,action:'inventory',qs:{id:params['Id']},headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  1974. * 创建一个清单任务
  1975. */function putBucketInventory(params,callback){return submitBucketInventory.call(this,'PUT',params,callback);}/**
  1976. * 创建一个一次性清单任务 会立即执行
  1977. */function postBucketInventory(params,callback){return submitBucketInventory.call(this,'POST',params,callback);}/**
  1978. * 获取 Bucket 的清单任务信息
  1979. * @param {Object} params 参数对象,必须
  1980. * @param {String} params.Bucket Bucket名称,必须
  1981. * @param {String} params.Region 地域名称,必须
  1982. * @param {String} params.Id 清单任务的名称,必须
  1983. * @param {Function} callback 回调函数,必须
  1984. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1985. * @return {Object} data 返回数据
  1986. */function getBucketInventory(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketInventory',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'inventory',qs:{id:params['Id']}},function(err,data){if(err)return callback(err);var InventoryConfiguration=data['InventoryConfiguration'];if(InventoryConfiguration&&InventoryConfiguration.OptionalFields&&InventoryConfiguration.OptionalFields.Field){var Field=InventoryConfiguration.OptionalFields.Field;if(!util.isArray(Field)){Field=[Field];}InventoryConfiguration.OptionalFields=Field;}if(InventoryConfiguration.Destination&&InventoryConfiguration.Destination.COSBucketDestination&&InventoryConfiguration.Destination.COSBucketDestination.Encryption){var Encryption=InventoryConfiguration.Destination.COSBucketDestination.Encryption;if(Object.keys(Encryption).indexOf('SSE-COS')>-1){Encryption['SSECOS']=Encryption['SSE-COS'];delete Encryption['SSE-COS'];}}callback(null,{InventoryConfiguration:InventoryConfiguration,statusCode:data.statusCode,headers:data.headers});});}/**
  1987. * 获取 Bucket 的清单任务信息
  1988. * @param {Object} params 参数对象,必须
  1989. * @param {String} params.Bucket Bucket名称,必须
  1990. * @param {String} params.Region 地域名称,必须
  1991. * @param {String} params.ContinuationToken 当 COS 响应体中 IsTruncated 为 true,且 NextContinuationToken 节点中存在参数值时,您可以将这个参数作为 continuation-token 参数值,以获取下一页的清单任务信息,非必须
  1992. * @param {Function} callback 回调函数,必须
  1993. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  1994. * @return {Object} data 返回数据
  1995. */function listBucketInventory(params,callback){submitRequest.call(this,{Action:'name/cos:ListBucketInventory',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'inventory',qs:{'continuation-token':params['ContinuationToken']}},function(err,data){if(err)return callback(err);var ListInventoryConfigurationResult=data['ListInventoryConfigurationResult'];var InventoryConfigurations=ListInventoryConfigurationResult.InventoryConfiguration||[];InventoryConfigurations=util.isArray(InventoryConfigurations)?InventoryConfigurations:[InventoryConfigurations];delete ListInventoryConfigurationResult['InventoryConfiguration'];util.each(InventoryConfigurations,function(InventoryConfiguration){if(InventoryConfiguration&&InventoryConfiguration.OptionalFields&&InventoryConfiguration.OptionalFields.Field){var Field=InventoryConfiguration.OptionalFields.Field;if(!util.isArray(Field)){Field=[Field];}InventoryConfiguration.OptionalFields=Field;}if(InventoryConfiguration.Destination&&InventoryConfiguration.Destination.COSBucketDestination&&InventoryConfiguration.Destination.COSBucketDestination.Encryption){var Encryption=InventoryConfiguration.Destination.COSBucketDestination.Encryption;if(Object.keys(Encryption).indexOf('SSE-COS')>-1){Encryption['SSECOS']=Encryption['SSE-COS'];delete Encryption['SSE-COS'];}}});ListInventoryConfigurationResult.InventoryConfigurations=InventoryConfigurations;util.extend(ListInventoryConfigurationResult,{statusCode:data.statusCode,headers:data.headers});callback(null,ListInventoryConfigurationResult);});}/**
  1996. * 删除 Bucket 的清单任务
  1997. * @param {Object} params 参数对象,必须
  1998. * @param {String} params.Bucket Bucket名称,必须
  1999. * @param {String} params.Region 地域名称,必须
  2000. * @param {String} params.Id 清单任务的名称,必须
  2001. * @param {Function} callback 回调函数,必须
  2002. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2003. * @return {Object} data 返回数据
  2004. */function deleteBucketInventory(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketInventory',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'inventory',qs:{id:params['Id']}},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/* 全球加速 */function putBucketAccelerate(params,callback){if(!params['AccelerateConfiguration']){callback(util.error(new Error('missing param AccelerateConfiguration')));return;}var configuration={AccelerateConfiguration:params.AccelerateConfiguration||{}};var xml=util.json2xml(configuration);var headers={};headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketAccelerate',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'accelerate',headers:headers},function(err,data){if(err)return callback(err);callback(null,{statusCode:data.statusCode,headers:data.headers});});}function getBucketAccelerate(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketAccelerate',method:'GET',Bucket:params.Bucket,Region:params.Region,action:'accelerate'},function(err,data){if(!err){!data.AccelerateConfiguration&&(data.AccelerateConfiguration={});}callback(err,data);});}function putBucketEncryption(params,callback){var conf=params.ServerSideEncryptionConfiguration||{};var Rules=conf.Rule||conf.Rules||[];var xml=util.json2xml({ServerSideEncryptionConfiguration:{Rule:Rules}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutBucketEncryption',method:'PUT',Bucket:params.Bucket,Region:params.Region,body:xml,action:'encryption',headers:headers},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}function getBucketEncryption(params,callback){submitRequest.call(this,{Action:'name/cos:GetBucketEncryption',method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'encryption'},function(err,data){if(err){if(err.statusCode===404&&err.code==='NoSuchEncryptionConfiguration'){var result={EncryptionConfiguration:{Rules:[]},statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var Rules=util.makeArray(data.EncryptionConfiguration&&data.EncryptionConfiguration.Rule||[]);data.EncryptionConfiguration={Rules:Rules};callback(err,data);});}function deleteBucketEncryption(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteBucketReplication',method:'DELETE',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'encryption'},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}// Object 相关
  2005. /**
  2006. * 取回对应Object的元数据,Head的权限与Get的权限一致
  2007. * @param {Object} params 参数对象,必须
  2008. * @param {String} params.Bucket Bucket名称,必须
  2009. * @param {String} params.Region 地域名称,必须
  2010. * @param {String} params.Key 文件名称,必须
  2011. * @param {String} params.IfModifiedSince 当Object在指定时间后被修改,则返回对应Object元信息,否则返回304,非必须
  2012. * @param {Function} callback 回调函数,必须
  2013. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2014. * @return {Object} data 为指定 object 的元数据,如果设置了 IfModifiedSince ,且文件未修改,则返回一个对象,NotModified 属性为 true
  2015. * @return {Boolean} data.NotModified 是否在 IfModifiedSince 时间点之后未修改该 object,则为 true
  2016. */function headObject(params,callback){submitRequest.call(this,{Action:'name/cos:HeadObject',method:'HEAD',Bucket:params.Bucket,Region:params.Region,Key:params.Key,VersionId:params.VersionId,headers:params.Headers},function(err,data){if(err){var statusCode=err.statusCode;if(params.Headers['If-Modified-Since']&&statusCode&&statusCode===304){return callback(null,{NotModified:true,statusCode:statusCode});}return callback(err);}data.ETag=util.attr(data.headers,'etag','');callback(null,data);});}function listObjectVersions(params,callback){var reqParams={};reqParams['prefix']=params['Prefix']||'';reqParams['delimiter']=params['Delimiter'];reqParams['key-marker']=params['KeyMarker'];reqParams['version-id-marker']=params['VersionIdMarker'];reqParams['max-keys']=params['MaxKeys'];reqParams['encoding-type']=params['EncodingType'];submitRequest.call(this,{Action:'name/cos:GetBucketObjectVersions',ResourceKey:reqParams['prefix'],method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,qs:reqParams,action:'versions'},function(err,data){if(err)return callback(err);var ListVersionsResult=data.ListVersionsResult||{};var DeleteMarkers=ListVersionsResult.DeleteMarker||[];DeleteMarkers=util.isArray(DeleteMarkers)?DeleteMarkers:[DeleteMarkers];var Versions=ListVersionsResult.Version||[];Versions=util.isArray(Versions)?Versions:[Versions];var result=util.clone(ListVersionsResult);delete result.DeleteMarker;delete result.Version;util.extend(result,{DeleteMarkers:DeleteMarkers,Versions:Versions,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  2017. * 下载 object
  2018. * @param {Object} params 参数对象,必须
  2019. * @param {String} params.Bucket Bucket名称,必须
  2020. * @param {String} params.Region 地域名称,必须
  2021. * @param {String} params.Key 文件名称,必须
  2022. * @param {WriteStream} params.Output 文件写入流,非必须
  2023. * @param {String} params.IfModifiedSince 当Object在指定时间后被修改,则返回对应Object元信息,否则返回304,非必须
  2024. * @param {String} params.IfUnmodifiedSince 如果文件修改时间早于或等于指定时间,才返回文件内容。否则返回 412 (precondition failed),非必须
  2025. * @param {String} params.IfMatch 当 ETag 与指定的内容一致,才返回文件。否则返回 412 (precondition failed),非必须
  2026. * @param {String} params.IfNoneMatch 当 ETag 与指定的内容不一致,才返回文件。否则返回304 (not modified),非必须
  2027. * @param {String} params.ResponseContentType 设置返回头部中的 Content-Type 参数,非必须
  2028. * @param {String} params.ResponseContentLanguage 设置返回头部中的 Content-Language 参数,非必须
  2029. * @param {String} params.ResponseExpires 设置返回头部中的 Content-Expires 参数,非必须
  2030. * @param {String} params.ResponseCacheControl 设置返回头部中的 Cache-Control 参数,非必须
  2031. * @param {String} params.ResponseContentDisposition 设置返回头部中的 Content-Disposition 参数,非必须
  2032. * @param {String} params.ResponseContentEncoding 设置返回头部中的 Content-Encoding 参数,非必须
  2033. * @param {Function} callback 回调函数,必须
  2034. * @param {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2035. * @param {Object} data 为对应的 object 数据,包括 body 和 headers
  2036. */function getObject(params,callback){var reqParams=params.Query||{};var reqParamsStr=params.QueryString||'';var onProgress=util.throttleOnProgress.call(this,0,params.onProgress);var tracker=params.tracker;tracker&&tracker.setParams({signStartTime:new Date().getTime()});reqParams['response-content-type']=params['ResponseContentType'];reqParams['response-content-language']=params['ResponseContentLanguage'];reqParams['response-expires']=params['ResponseExpires'];reqParams['response-cache-control']=params['ResponseCacheControl'];reqParams['response-content-disposition']=params['ResponseContentDisposition'];reqParams['response-content-encoding']=params['ResponseContentEncoding'];// 如果用户自己传入了 output
  2037. submitRequest.call(this,{Action:'name/cos:GetObject',method:'GET',Bucket:params.Bucket,Region:params.Region,Key:params.Key,VersionId:params.VersionId,DataType:params.DataType,headers:params.Headers,qs:reqParams,qsStr:reqParamsStr,rawBody:true,onDownloadProgress:onProgress,tracker:tracker},function(err,data){onProgress(null,true);if(err){var statusCode=err.statusCode;if(params.Headers['If-Modified-Since']&&statusCode&&statusCode===304){return callback(null,{NotModified:true});}return callback(err);}callback(null,{Body:data.body,ETag:util.attr(data.headers,'etag',''),statusCode:data.statusCode,headers:data.headers});});}/**
  2038. * 上传 object
  2039. * @param {Object} params 参数对象,必须
  2040. * @param {String} params.Bucket Bucket名称,必须
  2041. * @param {String} params.Region 地域名称,必须
  2042. * @param {String} params.Key 文件名称,必须
  2043. * @param {File || Blob || String} params.Body 上传文件对象或字符串,必须
  2044. * @param {String} params.CacheControl RFC 2616 中定义的缓存策略,将作为 Object 元数据保存,非必须
  2045. * @param {String} params.ContentDisposition RFC 2616 中定义的文件名称,将作为 Object 元数据保存,非必须
  2046. * @param {String} params.ContentEncoding RFC 2616 中定义的编码格式,将作为 Object 元数据保存,非必须
  2047. * @param {String} params.ContentLength RFC 2616 中定义的 HTTP 请求内容长度(字节),必须
  2048. * @param {String} params.ContentType RFC 2616 中定义的内容类型(MIME),将作为 Object 元数据保存,非必须
  2049. * @param {String} params.Expect 当使用 Expect: 100-continue 时,在收到服务端确认后,才会发送请求内容,非必须
  2050. * @param {String} params.Expires RFC 2616 中定义的过期时间,将作为 Object 元数据保存,非必须
  2051. * @param {String} params.ACL 允许用户自定义文件权限,有效值:private | public-read,非必须
  2052. * @param {String} params.GrantRead 赋予被授权者读取对象的权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2053. * @param {String} params.GrantReadAcp 赋予被授权者读取对象的访问控制列表(ACL)的权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2054. * @param {String} params.GrantWriteAcp 赋予被授权者写入对象的访问控制列表(ACL)的权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2055. * @param {String} params.GrantFullControl 赋予被授权者操作对象的所有权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2056. * @param {String} params.StorageClass 设置对象的存储级别,枚举值:STANDARD、STANDARD_IA、ARCHIVE,默认值:STANDARD,非必须
  2057. * @param {String} params.x-cos-meta-* 允许用户自定义的头部信息,将作为对象的元数据保存。大小限制2KB,非必须
  2058. * @param {String} params.ContentSha1 RFC 3174 中定义的 160-bit 内容 SHA-1 算法校验,非必须
  2059. * @param {String} params.ServerSideEncryption 支持按照指定的加密算法进行服务端数据加密,格式 x-cos-server-side-encryption: "AES256",非必须
  2060. * @param {Function} params.onProgress 上传进度回调函数
  2061. * @param {Function} callback 回调函数,必须
  2062. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2063. * @return {Object} data 为对应的 object 数据
  2064. * @return {String} data.ETag 为对应上传文件的 ETag 值
  2065. */function putObject(params,callback){var self=this;var FileSize=params.ContentLength;var onProgress=util.throttleOnProgress.call(self,FileSize,params.onProgress);// 特殊处理 Cache-Control、Content-Type,避免代理更改这两个字段导致写入到 Object 属性里
  2066. var headers=params.Headers;if(!headers['Cache-Control']&&!headers['cache-control'])headers['Cache-Control']='';if(!headers['Content-Type']&&!headers['content-type'])headers['Content-Type']=params.Body&&params.Body.type||'';var needCalcMd5=params.UploadAddMetaMd5||self.options.UploadAddMetaMd5||self.options.UploadCheckContentMd5;var tracker=params.tracker;needCalcMd5&&tracker&&tracker.setParams({md5StartTime:new Date().getTime()});util.getBodyMd5(needCalcMd5,params.Body,function(md5){if(md5){tracker&&tracker.setParams({md5EndTime:new Date().getTime()});if(self.options.UploadCheckContentMd5)headers['Content-MD5']=util.b64(md5);if(params.UploadAddMetaMd5||self.options.UploadAddMetaMd5)headers['x-cos-meta-md5']=md5;}if(params.ContentLength!==undefined)headers['Content-Length']=params.ContentLength;onProgress(null,true);// 任务状态开始 uploading
  2067. submitRequest.call(self,{Action:'name/cos:PutObject',TaskId:params.TaskId,method:'PUT',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,qs:params.Query,body:params.Body,onProgress:onProgress,tracker:tracker},function(err,data){if(err){onProgress(null,true);return callback(err);}onProgress({loaded:FileSize,total:FileSize},true);var url=getUrl({ForcePathStyle:self.options.ForcePathStyle,protocol:self.options.Protocol,domain:self.options.Domain,bucket:params.Bucket,region:!self.options.UseAccelerate?params.Region:'accelerate',object:params.Key});url=url.substr(url.indexOf('://')+3);data.Location=url;data.ETag=util.attr(data.headers,'etag','');callback(null,data);});},params.onHashProgress);}/**
  2068. * 删除 object
  2069. * @param {Object} params 参数对象,必须
  2070. * @param {String} params.Bucket Bucket名称,必须
  2071. * @param {String} params.Region 地域名称,必须
  2072. * @param {String} params.Key object名称,必须
  2073. * @param {Function} callback 回调函数,必须
  2074. * @param {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2075. * @param {Object} data 删除操作成功之后返回的数据
  2076. */function deleteObject(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteObject',method:'DELETE',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,VersionId:params.VersionId,action:params.Recursive?'recursive':''},function(err,data){if(err){var statusCode=err.statusCode;if(statusCode&&statusCode===404){return callback(null,{BucketNotFound:true,statusCode:statusCode});}else{return callback(err);}}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  2077. * 获取 object 的 权限列表
  2078. * @param {Object} params 参数对象,必须
  2079. * @param {String} params.Bucket Bucket名称,必须
  2080. * @param {String} params.Region 地域名称,必须
  2081. * @param {String} params.Key object名称,必须
  2082. * @param {Function} callback 回调函数,必须
  2083. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2084. * @return {Object} data 返回的数据
  2085. * @return {Object} data.AccessControlPolicy 权限列表
  2086. */function getObjectAcl(params,callback){var reqParams={};if(params.VersionId){reqParams.versionId=params.VersionId;}submitRequest.call(this,{Action:'name/cos:GetObjectACL',method:'GET',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,qs:reqParams,action:'acl'},function(err,data){if(err)return callback(err);var AccessControlPolicy=data.AccessControlPolicy||{};var Owner=AccessControlPolicy.Owner||{};var Grant=AccessControlPolicy.AccessControlList&&AccessControlPolicy.AccessControlList.Grant||[];Grant=util.isArray(Grant)?Grant:[Grant];var result=decodeAcl(AccessControlPolicy);delete result.GrantWrite;if(data.headers&&data.headers['x-cos-acl']){result.ACL=data.headers['x-cos-acl'];}result=util.extend(result,{Owner:Owner,Grants:Grant,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  2087. * 设置 object 的 权限列表
  2088. * @param {Object} params 参数对象,必须
  2089. * @param {String} params.Bucket Bucket名称,必须
  2090. * @param {String} params.Region 地域名称,必须
  2091. * @param {String} params.Key object名称,必须
  2092. * @param {Function} callback 回调函数,必须
  2093. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2094. * @return {Object} data 返回的数据
  2095. */function putObjectAcl(params,callback){var headers=params.Headers;var xml='';if(params['AccessControlPolicy']){var AccessControlPolicy=util.clone(params['AccessControlPolicy']||{});var Grants=AccessControlPolicy.Grants||AccessControlPolicy.Grant;Grants=util.isArray(Grants)?Grants:[Grants];delete AccessControlPolicy.Grant;delete AccessControlPolicy.Grants;AccessControlPolicy.AccessControlList={Grant:Grants};xml=util.json2xml({AccessControlPolicy:AccessControlPolicy});headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));}// Grant Header 去重
  2096. util.each(headers,function(val,key){if(key.indexOf('x-cos-grant-')===0){headers[key]=uniqGrant(headers[key]);}});submitRequest.call(this,{Action:'name/cos:PutObjectACL',method:'PUT',Bucket:params.Bucket,Region:params.Region,Key:params.Key,action:'acl',headers:headers,body:xml},function(err,data){if(err)return callback(err);callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  2097. * Options Object请求实现跨域访问的预请求。即发出一个 OPTIONS 请求给服务器以确认是否可以进行跨域操作。
  2098. * @param {Object} params 参数对象,必须
  2099. * @param {String} params.Bucket Bucket名称,必须
  2100. * @param {String} params.Region 地域名称,必须
  2101. * @param {String} params.Key object名称,必须
  2102. * @param {Function} callback 回调函数,必须
  2103. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2104. * @return {Object} data 返回的数据
  2105. */function optionsObject(params,callback){var headers=params.Headers;headers['Origin']=params['Origin'];headers['Access-Control-Request-Method']=params['AccessControlRequestMethod'];headers['Access-Control-Request-Headers']=params['AccessControlRequestHeaders'];submitRequest.call(this,{Action:'name/cos:OptionsObject',method:'OPTIONS',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:headers},function(err,data){if(err){if(err.statusCode&&err.statusCode===403){return callback(null,{OptionsForbidden:true,statusCode:err.statusCode});}return callback(err);}var headers=data.headers||{};callback(null,{AccessControlAllowOrigin:headers['access-control-allow-origin'],AccessControlAllowMethods:headers['access-control-allow-methods'],AccessControlAllowHeaders:headers['access-control-allow-headers'],AccessControlExposeHeaders:headers['access-control-expose-headers'],AccessControlMaxAge:headers['access-control-max-age'],statusCode:data.statusCode,headers:data.headers});});}/**
  2106. * @param {Object} 参数列表
  2107. * @param {String} Bucket Bucket 名称
  2108. * @param {String} Region 地域名称
  2109. * @param {String} Key 文件名称
  2110. * @param {String} CopySource 源文件URL绝对路径,可以通过versionid子资源指定历史版本
  2111. * @param {String} ACL 允许用户自定义文件权限。有效值:private,public-read默认值:private。
  2112. * @param {String} GrantRead 赋予被授权者读的权限,格式 x-cos-grant-read: uin=" ",uin=" ",当需要给子账户授权时,uin="RootAcountID/SubAccountID",当需要给根账户授权时,uin="RootAcountID"。
  2113. * @param {String} GrantWrite 赋予被授权者写的权限,格式 x-cos-grant-write: uin=" ",uin=" ",当需要给子账户授权时,uin="RootAcountID/SubAccountID",当需要给根账户授权时,uin="RootAcountID"。
  2114. * @param {String} GrantFullControl 赋予被授权者读写权限,格式 x-cos-grant-full-control: uin=" ",uin=" ",当需要给子账户授权时,uin="RootAcountID/SubAccountID",当需要给根账户授权时,uin="RootAcountID"。
  2115. * @param {String} MetadataDirective 是否拷贝元数据,枚举值:Copy, Replaced,默认值Copy。假如标记为Copy,忽略Header中的用户元数据信息直接复制;假如标记为Replaced,按Header信息修改元数据。当目标路径和原路径一致,即用户试图修改元数据时,必须为Replaced
  2116. * @param {String} CopySourceIfModifiedSince 当Object在指定时间后被修改,则执行操作,否则返回412。可与x-cos-copy-source-If-None-Match一起使用,与其他条件联合使用返回冲突。
  2117. * @param {String} CopySourceIfUnmodifiedSince 当Object在指定时间后未被修改,则执行操作,否则返回412。可与x-cos-copy-source-If-Match一起使用,与其他条件联合使用返回冲突。
  2118. * @param {String} CopySourceIfMatch 当Object的ETag和给定一致时,则执行操作,否则返回412。可与x-cos-copy-source-If-Unmodified-Since一起使用,与其他条件联合使用返回冲突。
  2119. * @param {String} CopySourceIfNoneMatch 当Object的ETag和给定不一致时,则执行操作,否则返回412。可与x-cos-copy-source-If-Modified-Since一起使用,与其他条件联合使用返回冲突。
  2120. * @param {String} StorageClass 存储级别,枚举值:存储级别,枚举值:Standard, Standard_IA,Archive;默认值:Standard
  2121. * @param {String} CacheControl 指定所有缓存机制在整个请求/响应链中必须服从的指令。
  2122. * @param {String} ContentDisposition MIME 协议的扩展,MIME 协议指示 MIME 用户代理如何显示附加的文件
  2123. * @param {String} ContentEncoding HTTP 中用来对「采用何种编码格式传输正文」进行协定的一对头部字段
  2124. * @param {String} ContentLength 设置响应消息的实体内容的大小,单位为字节
  2125. * @param {String} ContentType RFC 2616 中定义的 HTTP 请求内容类型(MIME),例如text/plain
  2126. * @param {String} Expect 请求的特定的服务器行为
  2127. * @param {String} Expires 响应过期的日期和时间
  2128. * @param {String} params.ServerSideEncryption 支持按照指定的加密算法进行服务端数据加密,格式 x-cos-server-side-encryption: "AES256",非必须
  2129. * @param {String} ContentLanguage 指定内容语言
  2130. * @param {String} x-cos-meta-* 允许用户自定义的头部信息,将作为 Object 元数据返回。大小限制2K。
  2131. */function putObjectCopy(params,callback){// 特殊处理 Cache-Control
  2132. var self=this;var headers=params.Headers;if(!headers['Cache-Control']&&!headers['cache-control'])headers['Cache-Control']='';var CopySource=params.CopySource||'';var m=util.getSourceParams.call(this,CopySource);if(!m){callback(util.error(new Error('CopySource format error')));return;}var SourceBucket=m.Bucket;var SourceRegion=m.Region;var SourceKey=decodeURIComponent(m.Key);submitRequest.call(this,{Scope:[{action:'name/cos:GetObject',bucket:SourceBucket,region:SourceRegion,prefix:SourceKey},{action:'name/cos:PutObject',bucket:params.Bucket,region:params.Region,prefix:params.Key}],method:'PUT',Bucket:params.Bucket,Region:params.Region,Key:params.Key,VersionId:params.VersionId,headers:params.Headers},function(err,data){if(err)return callback(err);var result=util.clone(data.CopyObjectResult||{});var url=getUrl({ForcePathStyle:self.options.ForcePathStyle,protocol:self.options.Protocol,domain:self.options.Domain,bucket:params.Bucket,region:params.Region,object:params.Key,isLocation:true});util.extend(result,{Location:url,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}function uploadPartCopy(params,callback){var CopySource=params.CopySource||'';var m=util.getSourceParams.call(this,CopySource);if(!m){callback(util.error(new Error('CopySource format error')));return;}var SourceBucket=m.Bucket;var SourceRegion=m.Region;var SourceKey=decodeURIComponent(m.Key);submitRequest.call(this,{Scope:[{action:'name/cos:GetObject',bucket:SourceBucket,region:SourceRegion,prefix:SourceKey},{action:'name/cos:PutObject',bucket:params.Bucket,region:params.Region,prefix:params.Key}],method:'PUT',Bucket:params.Bucket,Region:params.Region,Key:params.Key,VersionId:params.VersionId,qs:{partNumber:params['PartNumber'],uploadId:params['UploadId']},headers:params.Headers},function(err,data){if(err)return callback(err);var result=util.clone(data.CopyPartResult||{});util.extend(result,{statusCode:data.statusCode,headers:data.headers});callback(null,result);});}function deleteMultipleObject(params,callback){var Objects=params.Objects||[];var Quiet=params.Quiet;Objects=util.isArray(Objects)?Objects:[Objects];var xml=util.json2xml({Delete:{Object:Objects,Quiet:Quiet||false}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));var Scope=util.map(Objects,function(v){return{action:'name/cos:DeleteObject',bucket:params.Bucket,region:params.Region,prefix:v.Key};});submitRequest.call(this,{Scope:Scope,method:'POST',Bucket:params.Bucket,Region:params.Region,body:xml,action:'delete',headers:headers},function(err,data){if(err)return callback(err);var DeleteResult=data.DeleteResult||{};var Deleted=DeleteResult.Deleted||[];var Errors=DeleteResult.Error||[];Deleted=util.isArray(Deleted)?Deleted:[Deleted];Errors=util.isArray(Errors)?Errors:[Errors];var result=util.clone(DeleteResult);util.extend(result,{Error:Errors,Deleted:Deleted,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}function restoreObject(params,callback){var headers=params.Headers;if(!params['RestoreRequest']){callback(util.error(new Error('missing param RestoreRequest')));return;}var RestoreRequest=params.RestoreRequest||{};var xml=util.json2xml({RestoreRequest:RestoreRequest});headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:RestoreObject',method:'POST',Bucket:params.Bucket,Region:params.Region,Key:params.Key,VersionId:params.VersionId,body:xml,action:'restore',headers:headers},callback);}/**
  2133. * 设置 Object 的标签
  2134. * @param {Object} params 参数对象,必须
  2135. * @param {String} params.Bucket Object名称,必须
  2136. * @param {String} params.Region 地域名称,必须
  2137. * @param {Array} params.TagSet 标签设置,必须
  2138. * @param {Function} callback 回调函数,必须
  2139. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/42998
  2140. * @return {Object} data 返回数据
  2141. */function putObjectTagging(params,callback){var Tagging=params['Tagging']||{};var Tags=Tagging.TagSet||Tagging.Tags||params['Tags']||[];Tags=util.clone(util.isArray(Tags)?Tags:[Tags]);var xml=util.json2xml({Tagging:{TagSet:{Tag:Tags}}});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:PutObjectTagging',method:'PUT',Bucket:params.Bucket,Key:params.Key,Region:params.Region,body:xml,action:'tagging',headers:headers,VersionId:params.VersionId},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  2142. * 获取 Object 的标签设置
  2143. * @param {Object} params 参数对象,必须
  2144. * @param {String} params.Bucket Bucket名称,必须
  2145. * @param {String} params.Region 地域名称,必须
  2146. * @param {Function} callback 回调函数,必须
  2147. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/42998
  2148. * @return {Object} data 返回数据
  2149. */function getObjectTagging(params,callback){submitRequest.call(this,{Action:'name/cos:GetObjectTagging',method:'GET',Key:params.Key,Bucket:params.Bucket,Region:params.Region,headers:params.Headers,action:'tagging',VersionId:params.VersionId},function(err,data){if(err){if(err.statusCode===404&&err.error&&(err.error==='Not Found'||err.error.Code==='NoSuchTagSet')){var result={Tags:[],statusCode:err.statusCode};err.headers&&(result.headers=err.headers);callback(null,result);}else{callback(err);}return;}var Tags=[];try{Tags=data.Tagging.TagSet.Tag||[];}catch(e){}Tags=util.clone(util.isArray(Tags)?Tags:[Tags]);callback(null,{Tags:Tags,statusCode:data.statusCode,headers:data.headers});});}/**
  2150. * 删除 Object 的 标签设置
  2151. * @param {Object} params 参数对象,必须
  2152. * @param {String} params.Bucket Object名称,必须
  2153. * @param {String} params.Region 地域名称,必须
  2154. * @param {Function} callback 回调函数,必须
  2155. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/42998
  2156. * @return {Object} data 返回的数据
  2157. */function deleteObjectTagging(params,callback){submitRequest.call(this,{Action:'name/cos:DeleteObjectTagging',method:'DELETE',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,action:'tagging',VersionId:params.VersionId},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  2158. * 使用 SQL 语句从指定对象(CSV 格式或者 JSON 格式)中检索内容
  2159. * @param {Object} params 参数对象,必须
  2160. * @param {String} params.Bucket Object名称,必须
  2161. * @param {String} params.Region 地域名称,必须
  2162. * @param {Object} params.SelectRequest 地域名称,必须
  2163. * @param {Function} callback 回调函数,必须
  2164. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/42998
  2165. * @return {Object} data 返回的数据
  2166. */function selectObjectContent(params,callback){var SelectType=params['SelectType'];if(!SelectType)return callback(util.error(new Error('missing param SelectType')));var SelectRequest=params['SelectRequest']||{};var xml=util.json2xml({SelectRequest:SelectRequest});var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:GetObject',method:'POST',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,action:'select',qs:{'select-type':params['SelectType']},VersionId:params.VersionId,body:xml,DataType:'arraybuffer',rawBody:true},function(err,data){if(err&&err.statusCode===204){return callback(null,{statusCode:err.statusCode});}else if(err){return callback(err);}var result=util.parseSelectPayload(data.body);callback(null,{statusCode:data.statusCode,headers:data.headers,Body:result.body,Payload:result.payload});});}// 分块上传
  2167. /**
  2168. * 初始化分块上传
  2169. * @param {Object} params 参数对象,必须
  2170. * @param {String} params.Bucket Bucket名称,必须
  2171. * @param {String} params.Region 地域名称,必须
  2172. * @param {String} params.Key object名称,必须
  2173. * @param {String} params.UploadId object名称,必须
  2174. * @param {String} params.CacheControl RFC 2616 中定义的缓存策略,将作为 Object 元数据保存,非必须
  2175. * @param {String} params.ContentDisposition RFC 2616 中定义的文件名称,将作为 Object 元数据保存 ,非必须
  2176. * @param {String} params.ContentEncoding RFC 2616 中定义的编码格式,将作为 Object 元数据保存,非必须
  2177. * @param {String} params.ContentType RFC 2616 中定义的内容类型(MIME),将作为 Object 元数据保存,非必须
  2178. * @param {String} params.Expires RFC 2616 中定义的过期时间,将作为 Object 元数据保存,非必须
  2179. * @param {String} params.ACL 允许用户自定义文件权限,非必须
  2180. * @param {String} params.GrantRead 赋予被授权者读的权限 ,非必须
  2181. * @param {String} params.GrantWrite 赋予被授权者写的权限 ,非必须
  2182. * @param {String} params.GrantFullControl 赋予被授权者读写权限 ,非必须
  2183. * @param {String} params.StorageClass 设置Object的存储级别,枚举值:Standard,Standard_IA,Archive,非必须
  2184. * @param {String} params.ServerSideEncryption 支持按照指定的加密算法进行服务端数据加密,格式 x-cos-server-side-encryption: "AES256",非必须
  2185. * @param {Function} callback 回调函数,必须
  2186. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2187. * @return {Object} data 返回的数据
  2188. */function multipartInit(params,callback){var self=this;// 特殊处理 Cache-Control
  2189. var headers=params.Headers;var tracker=params.tracker;// 特殊处理 Cache-Control、Content-Type
  2190. if(!headers['Cache-Control']&&!headers['cache-control'])headers['Cache-Control']='';if(!headers['Content-Type']&&!headers['content-type'])headers['Content-Type']=params.Body&&params.Body.type||'';var needCalcMd5=params.Body&&(params.UploadAddMetaMd5||self.options.UploadAddMetaMd5);needCalcMd5&&tracker&&tracker.setParams({md5StartTime:new Date().getTime()});util.getBodyMd5(needCalcMd5,params.Body,function(md5){if(md5)params.Headers['x-cos-meta-md5']=md5;needCalcMd5&&tracker&&tracker.setParams({md5EndTime:new Date().getTime()});submitRequest.call(self,{Action:'name/cos:InitiateMultipartUpload',method:'POST',Bucket:params.Bucket,Region:params.Region,Key:params.Key,action:'uploads',headers:params.Headers,qs:params.Query,tracker:tracker},function(err,data){if(err){tracker&&tracker.parent&&tracker.parent.setParams({errorNode:'multipartInit'});return callback(err);}data=util.clone(data||{});if(data&&data.InitiateMultipartUploadResult){return callback(null,util.extend(data.InitiateMultipartUploadResult,{statusCode:data.statusCode,headers:data.headers}));}callback(null,data);});},params.onHashProgress);}/**
  2191. * 分块上传
  2192. * @param {Object} params 参数对象,必须
  2193. * @param {String} params.Bucket Bucket名称,必须
  2194. * @param {String} params.Region 地域名称,必须
  2195. * @param {String} params.Key object名称,必须
  2196. * @param {File || Blob || String} params.Body 上传文件对象或字符串
  2197. * @param {String} params.ContentLength RFC 2616 中定义的 HTTP 请求内容长度(字节),非必须
  2198. * @param {String} params.Expect 当使用 Expect: 100-continue 时,在收到服务端确认后,才会发送请求内容,非必须
  2199. * @param {String} params.ServerSideEncryption 支持按照指定的加密算法进行服务端数据加密,格式 x-cos-server-side-encryption: "AES256",非必须
  2200. * @param {String} params.ContentSha1 RFC 3174 中定义的 160-bit 内容 SHA-1 算法校验值,非必须
  2201. * @param {Function} callback 回调函数,必须
  2202. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2203. * @return {Object} data 返回的数据
  2204. * @return {Object} data.ETag 返回的文件分块 sha1 值
  2205. */function multipartUpload(params,callback){var self=this;util.getFileSize('multipartUpload',params,function(){var tracker=params.tracker;var needCalcMd5=self.options.UploadCheckContentMd5;needCalcMd5&&tracker&&tracker.setParams({md5StartTime:new Date().getTime()});util.getBodyMd5(needCalcMd5,params.Body,function(md5){if(md5)params.Headers['Content-MD5']=util.b64(md5);needCalcMd5&&tracker&&tracker.setParams({md5EndTime:new Date().getTime()});tracker&&tracker.setParams({partNumber:params.PartNumber});submitRequest.call(self,{Action:'name/cos:UploadPart',TaskId:params.TaskId,method:'PUT',Bucket:params.Bucket,Region:params.Region,Key:params.Key,qs:{partNumber:params['PartNumber'],uploadId:params['UploadId']},headers:params.Headers,onProgress:params.onProgress,body:params.Body||null,tracker:tracker},function(err,data){if(err){tracker&&tracker.parent&&tracker.parent.setParams({errorNode:'multipartUpload'});return callback(err);}callback(null,{ETag:util.attr(data.headers,'etag',''),statusCode:data.statusCode,headers:data.headers});});});});}/**
  2206. * 完成分块上传
  2207. * @param {Object} params 参数对象,必须
  2208. * @param {String} params.Bucket Bucket名称,必须
  2209. * @param {String} params.Region 地域名称,必须
  2210. * @param {String} params.Key object名称,必须
  2211. * @param {Array} params.Parts 分块信息列表,必须
  2212. * @param {String} params.Parts[i].PartNumber 块编号,必须
  2213. * @param {String} params.Parts[i].ETag 分块的 sha1 校验值
  2214. * @param {Function} callback 回调函数,必须
  2215. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2216. * @return {Object} data 返回的数据
  2217. * @return {Object} data.CompleteMultipartUpload 完成分块上传后的文件信息,包括Location, Bucket, Key 和 ETag
  2218. */function multipartComplete(params,callback){var self=this;var UploadId=params.UploadId;var Parts=params['Parts'];var tracker=params.tracker;for(var i=0,len=Parts.length;i<len;i++){if(Parts[i]['ETag']&&Parts[i]['ETag'].indexOf('"')===0){continue;}Parts[i]['ETag']='"'+Parts[i]['ETag']+'"';}var xml=util.json2xml({CompleteMultipartUpload:{Part:Parts}});// CSP/ceph CompleteMultipartUpload 接口 body 写死了限制 1MB,这里醉倒 10000 片时,xml 字符串去掉空格853KB
  2219. xml=xml.replace(/\n\s*/g,'');var headers=params.Headers;headers['Content-Type']='application/xml';headers['Content-MD5']=util.b64(util.md5(xml));submitRequest.call(this,{Action:'name/cos:CompleteMultipartUpload',method:'POST',Bucket:params.Bucket,Region:params.Region,Key:params.Key,qs:{uploadId:UploadId},body:xml,headers:headers,tracker:tracker},function(err,data){if(err){tracker&&tracker.parent&&tracker.parent.setParams({errorNode:'multipartComplete'});return callback(err);}var url=getUrl({ForcePathStyle:self.options.ForcePathStyle,protocol:self.options.Protocol,domain:self.options.Domain,bucket:params.Bucket,region:params.Region,object:params.Key,isLocation:true});var res=data.CompleteMultipartUploadResult||{};if(res.ProcessResults){if(res&&res.ProcessResults){res.UploadResult={OriginalInfo:{Key:res.Key,Location:url,ETag:res.ETag,ImageInfo:res.ImageInfo},ProcessResults:res.ProcessResults};delete res.ImageInfo;delete res.ProcessResults;}}var result=util.extend(res,{Location:url,statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  2220. * 分块上传任务列表查询
  2221. * @param {Object} params 参数对象,必须
  2222. * @param {String} params.Bucket Bucket名称,必须
  2223. * @param {String} params.Region 地域名称,必须
  2224. * @param {String} params.Delimiter 定界符为一个符号,如果有Prefix,则将Prefix到delimiter之间的相同路径归为一类,定义为Common Prefix,然后列出所有Common Prefix。如果没有Prefix,则从路径起点开始,非必须
  2225. * @param {String} params.EncodingType 规定返回值的编码方式,非必须
  2226. * @param {String} params.Prefix 前缀匹配,用来规定返回的文件前缀地址,非必须
  2227. * @param {String} params.MaxUploads 单次返回最大的条目数量,默认1000,非必须
  2228. * @param {String} params.KeyMarker 与upload-id-marker一起使用 </Br>当upload-id-marker未被指定时,ObjectName字母顺序大于key-marker的条目将被列出 </Br>当upload-id-marker被指定时,ObjectName字母顺序大于key-marker的条目被列出,ObjectName字母顺序等于key-marker同时UploadId大于upload-id-marker的条目将被列出,非必须
  2229. * @param {String} params.UploadIdMarker 与key-marker一起使用 </Br>当key-marker未被指定时,upload-id-marker将被忽略 </Br>当key-marker被指定时,ObjectName字母顺序大于key-marker的条目被列出,ObjectName字母顺序等于key-marker同时UploadId大于upload-id-marker的条目将被列出,非必须
  2230. * @param {Function} callback 回调函数,必须
  2231. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2232. * @return {Object} data 返回的数据
  2233. * @return {Object} data.ListMultipartUploadsResult 分块上传任务信息
  2234. */function multipartList(params,callback){var reqParams={};reqParams['delimiter']=params['Delimiter'];reqParams['encoding-type']=params['EncodingType'];reqParams['prefix']=params['Prefix']||'';reqParams['max-uploads']=params['MaxUploads'];reqParams['key-marker']=params['KeyMarker'];reqParams['upload-id-marker']=params['UploadIdMarker'];reqParams=util.clearKey(reqParams);var tracker=params.tracker;tracker&&tracker.setParams({signStartTime:new Date().getTime()});submitRequest.call(this,{Action:'name/cos:ListMultipartUploads',ResourceKey:reqParams['prefix'],method:'GET',Bucket:params.Bucket,Region:params.Region,headers:params.Headers,qs:reqParams,action:'uploads',tracker:tracker},function(err,data){if(err){tracker&&tracker.parent&&tracker.parent.setParams({errorNode:'multipartList'});return callback(err);}if(data&&data.ListMultipartUploadsResult){var Upload=data.ListMultipartUploadsResult.Upload||[];Upload=util.isArray(Upload)?Upload:[Upload];data.ListMultipartUploadsResult.Upload=Upload;}var result=util.clone(data.ListMultipartUploadsResult||{});util.extend(result,{statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  2235. * 上传的分块列表查询
  2236. * @param {Object} params 参数对象,必须
  2237. * @param {String} params.Bucket Bucket名称,必须
  2238. * @param {String} params.Region 地域名称,必须
  2239. * @param {String} params.Key object名称,必须
  2240. * @param {String} params.UploadId 标示本次分块上传的ID,必须
  2241. * @param {String} params.EncodingType 规定返回值的编码方式,非必须
  2242. * @param {String} params.MaxParts 单次返回最大的条目数量,默认1000,非必须
  2243. * @param {String} params.PartNumberMarker 默认以UTF-8二进制顺序列出条目,所有列出条目从marker开始,非必须
  2244. * @param {Function} callback 回调函数,必须
  2245. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2246. * @return {Object} data 返回的数据
  2247. * @return {Object} data.ListMultipartUploadsResult 分块信息
  2248. */function multipartListPart(params,callback){var reqParams={};var tracker=params.tracker;reqParams['uploadId']=params['UploadId'];reqParams['encoding-type']=params['EncodingType'];reqParams['max-parts']=params['MaxParts'];reqParams['part-number-marker']=params['PartNumberMarker'];submitRequest.call(this,{Action:'name/cos:ListParts',method:'GET',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,qs:reqParams},function(err,data){if(err){tracker&&tracker.parent&&tracker.parent.setParams({errorNode:'multipartListPart'});return callback(err);}var ListPartsResult=data.ListPartsResult||{};var Part=ListPartsResult.Part||[];Part=util.isArray(Part)?Part:[Part];ListPartsResult.Part=Part;var result=util.clone(ListPartsResult);util.extend(result,{statusCode:data.statusCode,headers:data.headers});callback(null,result);});}/**
  2249. * 抛弃分块上传
  2250. * @param {Object} params 参数对象,必须
  2251. * @param {String} params.Bucket Bucket名称,必须
  2252. * @param {String} params.Region 地域名称,必须
  2253. * @param {String} params.Key object名称,必须
  2254. * @param {String} params.UploadId 标示本次分块上传的ID,必须
  2255. * @param {Function} callback 回调函数,必须
  2256. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2257. * @return {Object} data 返回的数据
  2258. */function multipartAbort(params,callback){var reqParams={};reqParams['uploadId']=params['UploadId'];submitRequest.call(this,{Action:'name/cos:AbortMultipartUpload',method:'DELETE',Bucket:params.Bucket,Region:params.Region,Key:params.Key,headers:params.Headers,qs:reqParams},function(err,data){if(err)return callback(err);callback(null,{statusCode:data.statusCode,headers:data.headers});});}/**
  2259. * 抛弃分块上传
  2260. * @param {Object} params 参数对象,必须
  2261. * @param {String} params.Bucket Bucket名称,必须
  2262. * @param {String} params.Region 地域名称,必须
  2263. * @param {String} params.Key object名称,必须
  2264. * @param {String} params.UploadId 标示本次分块上传的ID,必须
  2265. * @param {Function} callback 回调函数,必须
  2266. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2267. * @return {Object} data 返回的数据
  2268. */function request(params,callback){submitRequest.call(this,{method:params.Method,Bucket:params.Bucket,Region:params.Region,Key:params.Key,action:params.Action,headers:params.Headers,qs:params.Query,body:params.Body,Url:params.Url,rawBody:params.RawBody,DataType:params.DataType},function(err,data){if(err)return callback(err);if(data&&data.body){data.Body=data.body;delete data.body;}callback(err,data);});}/**
  2269. * 追加上传
  2270. * @param {Object} params 参数对象,必须
  2271. * @param {String} params.Bucket Bucket名称,必须
  2272. * @param {String} params.Region 地域名称,必须
  2273. * @param {String} params.Key object名称,必须
  2274. * @param {File || Blob || String} params.Body 上传文件对象或字符串
  2275. * @param {Number} params.Position 追加操作的起始点,单位为字节,必须
  2276. * @param {String} params.CacheControl RFC 2616 中定义的缓存策略,将作为 Object 元数据保存,非必须
  2277. * @param {String} params.ContentDisposition RFC 2616 中定义的文件名称,将作为 Object 元数据保存,非必须
  2278. * @param {String} params.ContentEncoding RFC 2616 中定义的编码格式,将作为 Object 元数据保存,非必须
  2279. * @param {String} params.ContentLength RFC 2616 中定义的 HTTP 请求内容长度(字节),必须
  2280. * @param {String} params.ContentType RFC 2616 中定义的内容类型(MIME),将作为 Object 元数据保存,非必须
  2281. * @param {String} params.Expect 当使用 Expect: 100-continue 时,在收到服务端确认后,才会发送请求内容,非必须
  2282. * @param {String} params.Expires RFC 2616 中定义的过期时间,将作为 Object 元数据保存,非必须
  2283. * @param {String} params.ACL 允许用户自定义文件权限,有效值:private | public-read,非必须
  2284. * @param {String} params.GrantRead 赋予被授权者读取对象的权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2285. * @param {String} params.GrantReadAcp 赋予被授权者读取对象的访问控制列表(ACL)的权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2286. * @param {String} params.GrantWriteAcp 赋予被授权者写入对象的访问控制列表(ACL)的权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2287. * @param {String} params.GrantFullControl 赋予被授权者操作对象的所有权限,格式:id="[OwnerUin]",可使用半角逗号(,)分隔多组被授权者,非必须
  2288. * @param {String} params.StorageClass 设置对象的存储级别,枚举值:STANDARD、STANDARD_IA、ARCHIVE,默认值:STANDARD,非必须
  2289. * @param {String} params.x-cos-meta-* 允许用户自定义的头部信息,将作为对象的元数据保存。大小限制2KB,非必须
  2290. * @param {String} params.ContentSha1 RFC 3174 中定义的 160-bit 内容 SHA-1 算法校验,非必须
  2291. * @param {String} params.ServerSideEncryption 支持按照指定的加密算法进行服务端数据加密,格式 x-cos-server-side-encryption: "AES256",非必须
  2292. * @param {Function} callback 回调函数,必须
  2293. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2294. * @return {Object} data 返回的数据
  2295. */function appendObject(params,callback){// 特殊处理 Cache-Control、Content-Type,避免代理更改这两个字段导致写入到 Object 属性里
  2296. var headers=params.Headers;if(!headers['Cache-Control']&&!headers['cache-control'])headers['Cache-Control']='';if(!headers['Content-Type']&&!headers['content-type'])headers['Content-Type']=params.Body&&params.Body.type||'';submitRequest.call(this,{Action:'name/cos:AppendObject',method:'POST',Bucket:params.Bucket,Region:params.Region,action:'append',Key:params.Key,body:params.Body,qs:{position:params.Position},headers:params.Headers},function(err,data){if(err)return callback(err);callback(null,data);});}/**
  2297. * 获取签名
  2298. * @param {Object} params 参数对象,必须
  2299. * @param {String} params.Method 请求方法,必须
  2300. * @param {String} params.Key object名称,必须
  2301. * @param {String} params.Expires 名超时时间,单位秒,可选
  2302. * @return {String} data 返回签名字符串
  2303. */function getAuth(params){var self=this;return util.getAuth({SecretId:params.SecretId||this.options.SecretId||'',SecretKey:params.SecretKey||this.options.SecretKey||'',Bucket:params.Bucket,Region:params.Region,Method:params.Method,Key:params.Key,Query:params.Query,Headers:params.Headers,Expires:params.Expires,UseRawKey:self.options.UseRawKey,SystemClockOffset:self.options.SystemClockOffset});}/**
  2304. * 获取文件下载链接
  2305. * @param {Object} params 参数对象,必须
  2306. * @param {String} params.Bucket Bucket名称,必须
  2307. * @param {String} params.Region 地域名称,必须
  2308. * @param {String} params.Key object名称,必须
  2309. * @param {String} params.Method 请求的方法,可选
  2310. * @param {String} params.Expires 签名超时时间,单位秒,可选
  2311. * @param {Function} callback 回调函数,必须
  2312. * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730
  2313. * @return {Object} data 返回的数据
  2314. */function getObjectUrl(params,callback){var self=this;var useAccelerate=params.UseAccelerate===undefined?self.options.UseAccelerate:params.UseAccelerate;var url=getUrl({ForcePathStyle:self.options.ForcePathStyle,protocol:params.Protocol||self.options.Protocol,domain:params.Domain||self.options.Domain,bucket:params.Bucket,region:useAccelerate?'accelerate':params.Region,object:params.Key});var queryParamsStr='';if(params.Query){queryParamsStr+=util.obj2str(params.Query);}if(params.QueryString){queryParamsStr+=(queryParamsStr?'&':'')+params.QueryString;}var syncUrl=url;if(params.Sign!==undefined&&!params.Sign){queryParamsStr&&(syncUrl+='?'+queryParamsStr);callback(null,{Url:syncUrl});return syncUrl;}// 签名加上 Host,避免跨桶访问
  2315. var SignHost=getSignHost.call(this,{Bucket:params.Bucket,Region:params.Region,UseAccelerate:params.UseAccelerate,Url:url});var AuthData=getAuthorizationAsync.call(this,{Action:(params.Method||'').toUpperCase()==='PUT'?'name/cos:PutObject':'name/cos:GetObject',Bucket:params.Bucket||'',Region:params.Region||'',Method:params.Method||'get',Key:params.Key,Expires:params.Expires,Headers:params.Headers,Query:params.Query,SignHost:SignHost,ForceSignHost:params.ForceSignHost===false?false:self.options.ForceSignHost// getObjectUrl支持传参ForceSignHost
  2316. },function(err,AuthData){if(!callback)return;if(err){callback(err);return;}// 兼容万象url qUrlParamList需要再encode一次
  2317. var replaceUrlParamList=function replaceUrlParamList(url){var urlParams=url.match(/q-url-param-list.*?(?=&)/g)[0];var encodedParams='q-url-param-list='+encodeURIComponent(urlParams.replace(/q-url-param-list=/,'')).toLowerCase();var reg=new RegExp(urlParams,'g');var replacedUrl=url.replace(reg,encodedParams);return replacedUrl;};var signUrl=url;signUrl+='?'+(AuthData.Authorization.indexOf('q-signature')>-1?replaceUrlParamList(AuthData.Authorization):'sign='+encodeURIComponent(AuthData.Authorization));AuthData.SecurityToken&&(signUrl+='&x-cos-security-token='+AuthData.SecurityToken);AuthData.ClientIP&&(signUrl+='&clientIP='+AuthData.ClientIP);AuthData.ClientUA&&(signUrl+='&clientUA='+AuthData.ClientUA);AuthData.Token&&(signUrl+='&token='+AuthData.Token);queryParamsStr&&(signUrl+='&'+queryParamsStr);setTimeout(function(){callback(null,{Url:signUrl});});});if(AuthData){syncUrl+='?'+AuthData.Authorization+(AuthData.SecurityToken?'&x-cos-security-token='+AuthData.SecurityToken:'');queryParamsStr&&(syncUrl+='&'+queryParamsStr);}else{queryParamsStr&&(syncUrl+='?'+queryParamsStr);}return syncUrl;}/**
  2318. * 私有方法
  2319. */function decodeAcl(AccessControlPolicy){var result={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:''};var GrantMap={FULL_CONTROL:'GrantFullControl',WRITE:'GrantWrite',READ:'GrantRead',READ_ACP:'GrantReadAcp',WRITE_ACP:'GrantWriteAcp'};var AccessControlList=AccessControlPolicy&&AccessControlPolicy.AccessControlList||{};var Grant=AccessControlList.Grant;if(Grant){Grant=util.isArray(Grant)?Grant:[Grant];}var PublicAcl={READ:0,WRITE:0,FULL_CONTROL:0};Grant&&Grant.length&&util.each(Grant,function(item){if(item.Grantee.ID==='qcs::cam::anyone:anyone'||item.Grantee.URI==='http://cam.qcloud.com/groups/global/AllUsers'){PublicAcl[item.Permission]=1;}else if(item.Grantee.ID!==AccessControlPolicy.Owner.ID){result[GrantMap[item.Permission]].push('id="'+item.Grantee.ID+'"');}});if(PublicAcl.FULL_CONTROL||PublicAcl.WRITE&&PublicAcl.READ){result.ACL='public-read-write';}else if(PublicAcl.READ){result.ACL='public-read';}else{result.ACL='private';}util.each(GrantMap,function(item){result[item]=uniqGrant(result[item].join(','));});return result;}// Grant 去重
  2320. function uniqGrant(str){var arr=str.split(',');var exist={};var i,item;for(i=0;i<arr.length;){item=arr[i].trim();if(exist[item]){arr.splice(i,1);}else{exist[item]=true;arr[i]=item;i++;}}return arr.join(',');}// 生成操作 url
  2321. function getUrl(params){var region=params.region||'';var longBucket=params.bucket||'';var shortBucket=longBucket.substr(0,longBucket.lastIndexOf('-'));var appId=longBucket.substr(longBucket.lastIndexOf('-')+1);var domain=params.domain;var object=params.object;if(typeof domain==='function'){domain=domain({Bucket:longBucket,Region:region});}// 兼容不带冒号的http、https
  2322. if(['http','https'].includes(params.protocol)){params.protocol=params.protocol+':';}var protocol=params.protocol||(util.isBrowser&&(typeof location==="undefined"?"undefined":_typeof(location))==='object'&&location.protocol==='http:'?'http:':'https:');if(!domain){if(['cn-south','cn-south-2','cn-north','cn-east','cn-southwest','sg'].indexOf(region)>-1){domain='{Region}.myqcloud.com';}else{domain='cos.{Region}.myqcloud.com';}if(!params.ForcePathStyle){domain='{Bucket}.'+domain;}}domain=domain.replace(/\{\{AppId\}\}/gi,appId).replace(/\{\{Bucket\}\}/gi,shortBucket).replace(/\{\{Region\}\}/gi,region).replace(/\{\{.*?\}\}/gi,'');domain=domain.replace(/\{AppId\}/gi,appId).replace(/\{BucketName\}/gi,shortBucket).replace(/\{Bucket\}/gi,longBucket).replace(/\{Region\}/gi,region).replace(/\{.*?\}/gi,'');if(!/^[a-zA-Z]+:\/\//.test(domain)){domain=protocol+'//'+domain;}// 去掉域名最后的斜杆
  2323. if(domain.slice(-1)==='/'){domain=domain.slice(0,-1);}var url=domain;if(params.ForcePathStyle){url+='/'+longBucket;}url+='/';if(object){url+=util.camSafeUrlEncode(object).replace(/%2F/g,'/');}if(params.isLocation){url=url.replace(/^https?:\/\//,'');}return url;}var getSignHost=function getSignHost(opt){if(!opt.Bucket||!opt.Region)return'';var useAccelerate=opt.UseAccelerate===undefined?this.options.UseAccelerate:opt.UseAccelerate;var url=opt.Url||getUrl({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:opt.Bucket,region:useAccelerate?'accelerate':opt.Region});var urlHost=url.replace(/^https?:\/\/([^/]+)(\/.*)?$/,'$1');var standardHostReg=new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');if(standardHostReg.test(urlHost))return urlHost;return'';};// 异步获取签名
  2324. function getAuthorizationAsync(params,callback){var headers=util.clone(params.Headers);var headerHost='';util.each(headers,function(v,k){(v===''||['content-type','cache-control','expires'].indexOf(k.toLowerCase())>-1)&&delete headers[k];if(k.toLowerCase()==='host')headerHost=v;});// ForceSignHost明确传入false才不加入host签名
  2325. var forceSignHost=params.ForceSignHost===false?false:true;// Host 加入签名计算
  2326. if(!headerHost&&params.SignHost&&forceSignHost)headers.Host=params.SignHost;// 获取凭证的回调,避免用户 callback 多次
  2327. var cbDone=false;var cb=function cb(err,AuthData){if(cbDone)return;cbDone=true;if(AuthData&&AuthData.XCosSecurityToken&&!AuthData.SecurityToken){AuthData=util.clone(AuthData);AuthData.SecurityToken=AuthData.XCosSecurityToken;delete AuthData.XCosSecurityToken;}callback&&callback(err,AuthData);};var self=this;var Bucket=params.Bucket||'';var Region=params.Region||'';// PathName
  2328. var KeyName=params.Key||'';if(self.options.ForcePathStyle&&Bucket){KeyName=Bucket+'/'+KeyName;}var Pathname='/'+KeyName;// Action、ResourceKey
  2329. var StsData={};var Scope=params.Scope;if(!Scope){var Action=params.Action||'';var ResourceKey=params.ResourceKey||params.Key||'';Scope=params.Scope||[{action:Action,bucket:Bucket,region:Region,prefix:ResourceKey}];}var ScopeKey=util.md5(JSON.stringify(Scope));// STS
  2330. self._StsCache=self._StsCache||[];(function(){var i,AuthData;for(i=self._StsCache.length-1;i>=0;i--){AuthData=self._StsCache[i];var compareTime=Math.round(util.getSkewTime(self.options.SystemClockOffset)/1000)+30;if(AuthData.StartTime&&compareTime<AuthData.StartTime||compareTime>=AuthData.ExpiredTime){self._StsCache.splice(i,1);continue;}if(!AuthData.ScopeLimit||AuthData.ScopeLimit&&AuthData.ScopeKey===ScopeKey){StsData=AuthData;break;}}})();var calcAuthByTmpKey=function calcAuthByTmpKey(){var KeyTime='';if(StsData.StartTime&&params.Expires)KeyTime=StsData.StartTime+';'+(StsData.StartTime+params.Expires*1);else if(StsData.StartTime&&StsData.ExpiredTime)KeyTime=StsData.StartTime+';'+StsData.ExpiredTime;var Authorization=util.getAuth({SecretId:StsData.TmpSecretId,SecretKey:StsData.TmpSecretKey,Method:params.Method,Pathname:Pathname,Query:params.Query,Headers:headers,Expires:params.Expires,UseRawKey:self.options.UseRawKey,SystemClockOffset:self.options.SystemClockOffset,KeyTime:KeyTime,ForceSignHost:forceSignHost});var AuthData={Authorization:Authorization,SecurityToken:StsData.SecurityToken||StsData.XCosSecurityToken||'',Token:StsData.Token||'',ClientIP:StsData.ClientIP||'',ClientUA:StsData.ClientUA||''};cb(null,AuthData);};var checkAuthError=function checkAuthError(AuthData){if(AuthData.Authorization){// 检查签名格式
  2331. var formatAllow=false;var auth=AuthData.Authorization;if(auth){if(auth.indexOf(' ')>-1){formatAllow=false;}else if(auth.indexOf('q-sign-algorithm=')>-1&&auth.indexOf('q-ak=')>-1&&auth.indexOf('q-sign-time=')>-1&&auth.indexOf('q-key-time=')>-1&&auth.indexOf('q-url-param-list=')>-1){formatAllow=true;}else{try{auth=atob(auth);if(auth.indexOf('a=')>-1&&auth.indexOf('k=')>-1&&auth.indexOf('t=')>-1&&auth.indexOf('r=')>-1&&auth.indexOf('b=')>-1){formatAllow=true;}}catch(e){}}}if(!formatAllow)return util.error(new Error('getAuthorization callback params format error'));}else{if(!AuthData.TmpSecretId)return util.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!AuthData.TmpSecretKey)return util.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!AuthData.SecurityToken&&!AuthData.XCosSecurityToken)return util.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!AuthData.ExpiredTime)return util.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(AuthData.ExpiredTime&&AuthData.ExpiredTime.toString().length!==10)return util.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(AuthData.StartTime&&AuthData.StartTime.toString().length!==10)return util.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'));}return false;};// 先判断是否有临时密钥
  2332. if(StsData.ExpiredTime&&StsData.ExpiredTime-util.getSkewTime(self.options.SystemClockOffset)/1000>60){// 如果缓存的临时密钥有效,并还有超过60秒有效期就直接使用
  2333. calcAuthByTmpKey();}else if(self.options.getAuthorization){// 外部计算签名或获取临时密钥
  2334. self.options.getAuthorization.call(self,{Bucket:Bucket,Region:Region,Method:params.Method,Key:KeyName,Pathname:Pathname,Query:params.Query,Headers:headers,Scope:Scope,SystemClockOffset:self.options.SystemClockOffset,ForceSignHost:forceSignHost},function(AuthData){if(typeof AuthData==='string')AuthData={Authorization:AuthData};var AuthError=checkAuthError(AuthData);if(AuthError)return cb(AuthError);if(AuthData.Authorization){cb(null,AuthData);}else{StsData=AuthData||{};StsData.Scope=Scope;StsData.ScopeKey=ScopeKey;self._StsCache.push(StsData);calcAuthByTmpKey();}});}else if(self.options.getSTS){// 外部获取临时密钥
  2335. self.options.getSTS.call(self,{Bucket:Bucket,Region:Region},function(data){StsData=data||{};StsData.Scope=Scope;StsData.ScopeKey=ScopeKey;if(!StsData.TmpSecretId)StsData.TmpSecretId=StsData.SecretId;if(!StsData.TmpSecretKey)StsData.TmpSecretKey=StsData.SecretKey;var AuthError=checkAuthError(StsData);if(AuthError)return cb(AuthError);self._StsCache.push(StsData);calcAuthByTmpKey();});}else{// 内部计算获取签名
  2336. return function(){var Authorization=util.getAuth({SecretId:params.SecretId||self.options.SecretId,SecretKey:params.SecretKey||self.options.SecretKey,Method:params.Method,Pathname:Pathname,Query:params.Query,Headers:headers,Expires:params.Expires,UseRawKey:self.options.UseRawKey,SystemClockOffset:self.options.SystemClockOffset,ForceSignHost:forceSignHost});var AuthData={Authorization:Authorization,SecurityToken:self.options.SecurityToken||self.options.XCosSecurityToken};cb(null,AuthData);return AuthData;}();}return'';}// 调整时间偏差
  2337. function allowRetry(err){var allowRetry=false;var isTimeError=false;var serverDate=err.headers&&(err.headers.date||err.headers.Date)||err.error&&err.error.ServerTime;try{var errorCode=err.error.Code;var errorMessage=err.error.Message;if(errorCode==='RequestTimeTooSkewed'||errorCode==='AccessDenied'&&errorMessage==='Request has expired'){isTimeError=true;}}catch(e){}if(err){if(isTimeError&&serverDate){var serverTime=Date.parse(serverDate);if(this.options.CorrectClockSkew&&Math.abs(util.getSkewTime(this.options.SystemClockOffset)-serverTime)>=30000){console.error('error: Local time is too skewed.');this.options.SystemClockOffset=serverTime-Date.now();allowRetry=true;}}else if(Math.floor(err.statusCode/100)===5){allowRetry=true;}}return allowRetry;}// 获取签名并发起请求
  2338. function submitRequest(params,callback){var self=this;// 处理 headers
  2339. !params.headers&&(params.headers={});// 处理 query
  2340. !params.qs&&(params.qs={});params.VersionId&&(params.qs.versionId=params.VersionId);params.qs=util.clearKey(params.qs);// 清理 undefined 和 null 字段
  2341. params.headers&&(params.headers=util.clearKey(params.headers));params.qs&&(params.qs=util.clearKey(params.qs));var Query=util.clone(params.qs);params.action&&(Query[params.action]='');var paramsUrl=params.url||params.Url;var SignHost=params.SignHost||getSignHost.call(this,{Bucket:params.Bucket,Region:params.Region,Url:paramsUrl});var tracker=params.tracker;var next=function next(tryTimes){var oldClockOffset=self.options.SystemClockOffset;tracker&&tracker.setParams({signStartTime:new Date().getTime(),retryTimes:tryTimes-1});getAuthorizationAsync.call(self,{Bucket:params.Bucket||'',Region:params.Region||'',Method:params.method,Key:params.Key,Query:Query,Headers:params.headers,SignHost:SignHost,Action:params.Action,ResourceKey:params.ResourceKey,Scope:params.Scope,ForceSignHost:self.options.ForceSignHost},function(err,AuthData){if(err){callback(err);return;}tracker&&tracker.setParams({signEndTime:new Date().getTime(),httpStartTime:new Date().getTime()});params.AuthData=AuthData;_submitRequest.call(self,params,function(err,data){tracker&&tracker.setParams({httpEndTime:new Date().getTime()});if(err&&tryTimes<2&&(oldClockOffset!==self.options.SystemClockOffset||allowRetry.call(self,err))){if(params.headers){delete params.headers.Authorization;delete params.headers['token'];delete params.headers['clientIP'];delete params.headers['clientUA'];params.headers['x-cos-security-token']&&delete params.headers['x-cos-security-token'];params.headers['x-ci-security-token']&&delete params.headers['x-ci-security-token'];}next(tryTimes+1);}else{callback(err,data);}});});};next(1);}// 发起请求
  2342. function _submitRequest(params,callback){var self=this;var TaskId=params.TaskId;if(TaskId&&!self._isRunningTask(TaskId))return;var bucket=params.Bucket;var region=params.Region;var object=params.Key;var method=params.method||'GET';var url=params.Url||params.url;var body=params.body;var rawBody=params.rawBody;// url
  2343. if(self.options.UseAccelerate){region='accelerate';}url=url||getUrl({ForcePathStyle:self.options.ForcePathStyle,protocol:self.options.Protocol,domain:self.options.Domain,bucket:bucket,region:region,object:object});if(params.action){// 已知问题,某些版本的qq会对url自动拼接(比如/upload被拼接成/upload=(null))导致签名错误,这里做下兼容。
  2344. url=url+'?'+(util.isIOS_QQ?"".concat(params.action,"="):params.action);}if(params.qsStr){if(url.indexOf('?')>-1){url=url+'&'+params.qsStr;}else{url=url+'?'+params.qsStr;}}var opt={method:method,url:url,headers:params.headers,qs:params.qs,body:body};// 兼容ci接口
  2345. var token='x-cos-security-token';if(util.isCIHost(url)){token='x-ci-security-token';}// 获取签名
  2346. opt.headers.Authorization=params.AuthData.Authorization;params.AuthData.Token&&(opt.headers['token']=params.AuthData.Token);params.AuthData.ClientIP&&(opt.headers['clientIP']=params.AuthData.ClientIP);params.AuthData.ClientUA&&(opt.headers['clientUA']=params.AuthData.ClientUA);params.AuthData.SecurityToken&&(opt.headers[token]=params.AuthData.SecurityToken);// 清理 undefined 和 null 字段
  2347. opt.headers&&(opt.headers=util.clearKey(opt.headers));opt=util.clearKey(opt);// progress
  2348. if(params.onProgress&&typeof params.onProgress==='function'){var contentLength=body&&(body.size||body.length)||0;opt.onProgress=function(e){if(TaskId&&!self._isRunningTask(TaskId))return;var loaded=e?e.loaded:0;params.onProgress({loaded:loaded,total:contentLength});};}if(params.onDownloadProgress){opt.onDownloadProgress=params.onDownloadProgress;}if(params.DataType){opt.dataType=params.DataType;}if(this.options.Timeout){opt.timeout=this.options.Timeout;}self.options.ForcePathStyle&&(opt.pathStyle=self.options.ForcePathStyle);self.emit('before-send',opt);var useAccelerate=opt.url.includes('accelerate.');var queryString=opt.qs?Object.keys(opt.qs).map(function(key){return"".concat(key,"=").concat(opt.qs[key]);}).join('&'):'';var fullUrl=queryString?opt.url+'?'+queryString:opt.url;params.tracker&&params.tracker.setParams({reqUrl:fullUrl,accelerate:useAccelerate?'Y':'N'});// 分块上传时给父级tracker设置url信息
  2349. params.tracker&&params.tracker.parent&&params.tracker.parent.setParams({reqUrl:fullUrl,accelerate:useAccelerate?'Y':'N'});var sender=(self.options.Request||REQUEST)(opt,function(r){if(r&&r.error==='abort')return;var receive={options:opt,error:r&&r.error,statusCode:r&&r.statusCode||0,statusMessage:r&&r.statusMessage||'',headers:r&&r.headers||{},body:r&&r.body};// 抛出事件,允许修改返回值的 error、statusCode、statusMessage、body
  2350. self.emit('after-receive',receive);var err=receive.error;var body=receive.body;// 返回内容添加 状态码 和 headers
  2351. var response={statusCode:receive.statusCode,statusMessage:receive.statusMessage,headers:receive.headers};var hasReturned;var cb=function cb(err,data){TaskId&&self.off('inner-kill-task',killTask);if(hasReturned)return;hasReturned=true;var attrs={};response&&response.statusCode&&(attrs.statusCode=response.statusCode);response&&response.headers&&(attrs.headers=response.headers);if(err){err=util.extend(err||{},attrs);callback(err,null);}else{data=util.extend(data||{},attrs);callback(null,data);}sender=null;};// 请求错误,发生网络错误
  2352. if(err)return cb(util.error(err));// 请求返回码不为 200
  2353. var statusCode=response.statusCode;var statusSuccess=Math.floor(statusCode/100)===2;// 200 202 204 206
  2354. // 不对 body 进行转换,body 直接挂载返回
  2355. if(rawBody&&statusSuccess)return cb(null,{body:body});// 解析 xml body
  2356. var json;try{json=body&&body.indexOf('<')>-1&&body.indexOf('>')>-1&&util.xml2json(body)||{};}catch(e){json={};}// 处理返回值
  2357. var xmlError=json&&json.Error;if(statusSuccess){// 正确返回,状态码 2xx 时,body 不会有 Error
  2358. cb(null,json);}else if(xmlError){// 正常返回了 xml body,且有 Error 节点
  2359. cb(util.error(new Error(xmlError.Message),{code:xmlError.Code,error:xmlError}));}else if(statusCode){// 有错误的状态码
  2360. cb(util.error(new Error(response.statusMessage),{code:''+statusCode}));}else if(statusCode){// 无状态码,或者获取不到状态码
  2361. cb(util.error(new Error('statusCode error')));}});// kill task
  2362. var killTask=function killTask(data){if(data.TaskId===TaskId){sender&&sender.abort&&sender.abort();self.off('inner-kill-task',killTask);}};TaskId&&self.on('inner-kill-task',killTask);}var API_MAP={// Bucket 相关方法
  2363. getService:getService,// Bucket
  2364. putBucket:putBucket,headBucket:headBucket,// Bucket
  2365. getBucket:getBucket,deleteBucket:deleteBucket,putBucketAcl:putBucketAcl,// BucketACL
  2366. getBucketAcl:getBucketAcl,putBucketCors:putBucketCors,// BucketCors
  2367. getBucketCors:getBucketCors,deleteBucketCors:deleteBucketCors,getBucketLocation:getBucketLocation,// BucketLocation
  2368. getBucketPolicy:getBucketPolicy,// BucketPolicy
  2369. putBucketPolicy:putBucketPolicy,deleteBucketPolicy:deleteBucketPolicy,putBucketTagging:putBucketTagging,// BucketTagging
  2370. getBucketTagging:getBucketTagging,deleteBucketTagging:deleteBucketTagging,putBucketLifecycle:putBucketLifecycle,// BucketLifecycle
  2371. getBucketLifecycle:getBucketLifecycle,deleteBucketLifecycle:deleteBucketLifecycle,putBucketVersioning:putBucketVersioning,// BucketVersioning
  2372. getBucketVersioning:getBucketVersioning,putBucketReplication:putBucketReplication,// BucketReplication
  2373. getBucketReplication:getBucketReplication,deleteBucketReplication:deleteBucketReplication,putBucketWebsite:putBucketWebsite,// BucketWebsite
  2374. getBucketWebsite:getBucketWebsite,deleteBucketWebsite:deleteBucketWebsite,putBucketReferer:putBucketReferer,// BucketReferer
  2375. getBucketReferer:getBucketReferer,putBucketDomain:putBucketDomain,// BucketDomain
  2376. getBucketDomain:getBucketDomain,deleteBucketDomain:deleteBucketDomain,putBucketOrigin:putBucketOrigin,// BucketOrigin
  2377. getBucketOrigin:getBucketOrigin,deleteBucketOrigin:deleteBucketOrigin,putBucketLogging:putBucketLogging,// BucketLogging
  2378. getBucketLogging:getBucketLogging,putBucketInventory:putBucketInventory,// BucketInventory
  2379. postBucketInventory:postBucketInventory,getBucketInventory:getBucketInventory,listBucketInventory:listBucketInventory,deleteBucketInventory:deleteBucketInventory,putBucketAccelerate:putBucketAccelerate,getBucketAccelerate:getBucketAccelerate,putBucketEncryption:putBucketEncryption,getBucketEncryption:getBucketEncryption,deleteBucketEncryption:deleteBucketEncryption,// Object 相关方法
  2380. getObject:getObject,headObject:headObject,listObjectVersions:listObjectVersions,putObject:putObject,deleteObject:deleteObject,getObjectAcl:getObjectAcl,putObjectAcl:putObjectAcl,optionsObject:optionsObject,putObjectCopy:putObjectCopy,deleteMultipleObject:deleteMultipleObject,restoreObject:restoreObject,putObjectTagging:putObjectTagging,getObjectTagging:getObjectTagging,deleteObjectTagging:deleteObjectTagging,selectObjectContent:selectObjectContent,appendObject:appendObject,// 分块上传相关方法
  2381. uploadPartCopy:uploadPartCopy,multipartInit:multipartInit,multipartUpload:multipartUpload,multipartComplete:multipartComplete,multipartList:multipartList,multipartListPart:multipartListPart,multipartAbort:multipartAbort,// 工具方法
  2382. request:request,getObjectUrl:getObjectUrl,getAuth:getAuth};function warnOldApi(apiName,fn,proto){util.each(['Cors','Acl'],function(suffix){if(apiName.slice(-suffix.length)===suffix){var oldName=apiName.slice(0,-suffix.length)+suffix.toUpperCase();var apiFn=util.apiWrapper(apiName,fn);var warned=false;proto[oldName]=function(){!warned&&console.warn('warning: cos.'+oldName+' has been deprecated. Please Use cos.'+apiName+' instead.');warned=true;apiFn.apply(this,arguments);};}});}module.exports.init=function(COS,task){task.transferToTaskMethod(API_MAP,'putObject');util.each(API_MAP,function(fn,apiName){COS.prototype[apiName]=util.apiWrapper(apiName,fn);warnOldApi(apiName,fn,COS.prototype);});};/***/},/***/"./src/cos.js":/*!********************!*\
  2383. !*** ./src/cos.js ***!
  2384. \********************/ /*! no static exports found */ /***/function srcCosJs(module,exports,__webpack_require__){var util=__webpack_require__(/*! ./util */"./src/util.js");var event=__webpack_require__(/*! ./event */"./src/event.js");var task=__webpack_require__(/*! ./task */"./src/task.js");var base=__webpack_require__(/*! ./base */"./src/base.js");var advance=__webpack_require__(/*! ./advance */"./src/advance.js");var pkg=__webpack_require__(/*! ../package.json */"./package.json");var defaultOptions={AppId:'',// AppId 已废弃,请拼接到 Bucket 后传入,例如:test-1250000000
  2385. SecretId:'',SecretKey:'',SecurityToken:'',// 使用临时密钥需要注意自行刷新 Token
  2386. ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1024*1024,SliceSize:1024*1024,CopyChunkParallelLimit:20,CopyChunkSize:1024*1024*10,CopySliceSize:1024*1024*10,MaxPartNumber:10000,ProgressInterval:1000,Domain:'',ServiceDomain:'',Protocol:'',CompatibilityMode:false,ForcePathStyle:false,UseRawKey:false,Timeout:0,// 单位毫秒,0 代表不设置超时时间
  2387. CorrectClockSkew:true,SystemClockOffset:0,// 单位毫秒,ms
  2388. UploadCheckContentMd5:false,UploadQueueSize:10000,UploadAddMetaMd5:false,UploadIdCacheLimit:50,UseAccelerate:false,ForceSignHost:true,// 默认将host加入签名计算,关闭后可能导致越权风险,建议保持为true
  2389. EnableTracker:false,// 默认关闭上报
  2390. DeepTracker:false,// 上报时是否对每个分块上传做单独上报
  2391. TrackerDelay:5000,// 周期性上报,单位毫秒。0代表实时上报
  2392. CustomId:''// 自定义上报id
  2393. };// 对外暴露的类
  2394. var COS=function COS(options){this.options=util.extend(util.clone(defaultOptions),options||{});this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit);this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit);this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes);this.options.ChunkSize=Math.max(1024*1024,this.options.ChunkSize);this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit);this.options.CopyChunkSize=Math.max(1024*1024,this.options.CopyChunkSize);this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize);this.options.MaxPartNumber=Math.max(1024,Math.min(10000,this.options.MaxPartNumber));this.options.Timeout=Math.max(0,this.options.Timeout);if(this.options.AppId){console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").');}if(this.options.SecretId&&this.options.SecretId.indexOf(' ')>-1){console.error('error: SecretId格式错误,请检查');console.error('error: SecretId format is incorrect. Please check');}if(this.options.SecretKey&&this.options.SecretKey.indexOf(' ')>-1){console.error('error: SecretKey格式错误,请检查');console.error('error: SecretKey format is incorrect. Please check');}if(util.isNode()){console.warn('warning: cos-js-sdk-v5 不支持 nodejs 环境使用,请改用 cos-nodejs-sdk-v5,参考文档: https://cloud.tencent.com/document/product/436/8629');console.warn('warning: cos-js-sdk-v5 does not support nodejs environment. Please use cos-nodejs-sdk-v5 instead. See: https://cloud.tencent.com/document/product/436/8629');}event.init(this);task.init(this);};base.init(COS,task);advance.init(COS,task);COS.util={md5:util.md5,xml2json:util.xml2json,json2xml:util.json2xml,encodeBase64:util.encodeBase64};COS.getAuthorization=util.getAuth;COS.version=pkg.version;module.exports=COS;/***/},/***/"./src/event.js":/*!**********************!*\
  2395. !*** ./src/event.js ***!
  2396. \**********************/ /*! no static exports found */ /***/function srcEventJs(module,exports){var initEvent=function initEvent(cos){var listeners={};var getList=function getList(action){!listeners[action]&&(listeners[action]=[]);return listeners[action];};cos.on=function(action,callback){if(action==='task-list-update'){console.warn('warning: Event "'+action+'" has been deprecated. Please use "list-update" instead.');}getList(action).push(callback);};cos.off=function(action,callback){var list=getList(action);for(var i=list.length-1;i>=0;i--){callback===list[i]&&list.splice(i,1);}};cos.emit=function(action,data){var list=getList(action).map(function(cb){return cb;});for(var i=0;i<list.length;i++){list[i](data);}};};var EventProxy=function EventProxy(){initEvent(this);};module.exports.init=initEvent;module.exports.EventProxy=EventProxy;/***/},/***/"./src/session.js":/*!************************!*\
  2397. !*** ./src/session.js ***!
  2398. \************************/ /*! no static exports found */ /***/function srcSessionJs(module,exports,__webpack_require__){var util=__webpack_require__(/*! ./util */"./src/util.js");// 按照文件特征值,缓存 UploadId
  2399. var cacheKey='cos_sdk_upload_cache';var expires=30*24*3600;var cache;var timer;var getCache=function getCache(){try{var val=JSON.parse(localStorage.getItem(cacheKey));}catch(e){}if(!val)val=[];cache=val;};var setCache=function setCache(){try{if(cache.length)localStorage.setItem(cacheKey,JSON.stringify(cache));else localStorage.removeItem(cacheKey);}catch(e){}};var init=function init(){if(cache)return;getCache.call(this);// 清理太老旧的数据
  2400. var changed=false;var now=Math.round(Date.now()/1000);for(var i=cache.length-1;i>=0;i--){var mtime=cache[i][2];if(!mtime||mtime+expires<now){cache.splice(i,1);changed=true;}}changed&&setCache();};// 把缓存存到本地
  2401. var save=function save(){if(timer)return;timer=setTimeout(function(){setCache();timer=null;},400);};var mod={using:{},// 标记 UploadId 正在使用
  2402. setUsing:function setUsing(uuid){mod.using[uuid]=true;},// 标记 UploadId 已经没在使用
  2403. removeUsing:function removeUsing(uuid){delete mod.using[uuid];},// 用上传参数生成哈希值
  2404. getFileId:function getFileId(file,ChunkSize,Bucket,Key){if(file.name&&file.size&&file.lastModifiedDate&&ChunkSize){return util.md5([file.name,file.size,file.lastModifiedDate,ChunkSize,Bucket,Key].join('::'));}else{return null;}},// 用上传参数生成哈希值
  2405. getCopyFileId:function getCopyFileId(copySource,sourceHeaders,ChunkSize,Bucket,Key){var size=sourceHeaders['content-length'];var etag=sourceHeaders.etag||'';var lastModified=sourceHeaders['last-modified'];if(copySource&&ChunkSize){return util.md5([copySource,size,etag,lastModified,ChunkSize,Bucket,Key].join('::'));}else{return null;}},// 获取文件对应的 UploadId 列表
  2406. getUploadIdList:function getUploadIdList(uuid){if(!uuid)return null;init.call(this);var list=[];for(var i=0;i<cache.length;i++){if(cache[i][0]===uuid)list.push(cache[i][1]);}return list.length?list:null;},// 缓存 UploadId
  2407. saveUploadId:function saveUploadId(uuid,UploadId,limit){init.call(this);if(!uuid)return;// 清理没用的 UploadId,js 文件没有 FilePath ,只清理相同记录
  2408. for(var i=cache.length-1;i>=0;i--){var item=cache[i];if(item[0]===uuid&&item[1]===UploadId){cache.splice(i,1);}}cache.unshift([uuid,UploadId,Math.round(Date.now()/1000)]);if(cache.length>limit)cache.splice(limit);save();},// UploadId 已用完,移除掉
  2409. removeUploadId:function removeUploadId(UploadId){init.call(this);delete mod.using[UploadId];for(var i=cache.length-1;i>=0;i--){if(cache[i][1]===UploadId)cache.splice(i,1);}save();}};module.exports=mod;/***/},/***/"./src/task.js":/*!*********************!*\
  2410. !*** ./src/task.js ***!
  2411. \*********************/ /*! no static exports found */ /***/function srcTaskJs(module,exports,__webpack_require__){var session=__webpack_require__(/*! ./session */"./src/session.js");var util=__webpack_require__(/*! ./util */"./src/util.js");var originApiMap={};var transferToTaskMethod=function transferToTaskMethod(apiMap,apiName){originApiMap[apiName]=apiMap[apiName];apiMap[apiName]=function(params,callback){if(params.SkipTask){originApiMap[apiName].call(this,params,callback);}else{this._addTask(apiName,params,callback);}};};var initTask=function initTask(cos){var queue=[];var tasks={};var uploadingFileCount=0;var nextUploadIndex=0;// 接口返回简略的任务信息
  2412. var formatTask=function formatTask(task){var t={id:task.id,Bucket:task.Bucket,Region:task.Region,Key:task.Key,FilePath:task.FilePath,state:task.state,loaded:task.loaded,size:task.size,speed:task.speed,percent:task.percent,hashPercent:task.hashPercent,error:task.error};if(task.FilePath)t.FilePath=task.FilePath;if(task._custom)t._custom=task._custom;// 控制台使用
  2413. return t;};var emitListUpdate=function(){var timer;var emit=function emit(){timer=0;cos.emit('task-list-update',{list:util.map(queue,formatTask)});cos.emit('list-update',{list:util.map(queue,formatTask)});};return function(){if(!timer)timer=setTimeout(emit);};}();var clearQueue=function clearQueue(){if(queue.length<=cos.options.UploadQueueSize)return;for(var i=0;i<nextUploadIndex&&// 小于当前操作的 index 才清理
  2414. i<queue.length&&// 大于队列才清理
  2415. queue.length>cos.options.UploadQueueSize;){var isActive=queue[i].state==='waiting'||queue[i].state==='checking'||queue[i].state==='uploading';if(!queue[i]||!isActive){tasks[queue[i].id]&&delete tasks[queue[i].id];queue.splice(i,1);nextUploadIndex--;}else{i++;}}emitListUpdate();};var startNextTask=function startNextTask(){// 检查是否允许增加执行进程
  2416. if(uploadingFileCount>=cos.options.FileParallelLimit)return;// 跳过不可执行的任务
  2417. while(queue[nextUploadIndex]&&queue[nextUploadIndex].state!=='waiting'){nextUploadIndex++;}// 检查是否已遍历结束
  2418. if(nextUploadIndex>=queue.length)return;// 上传该遍历到的任务
  2419. var task=queue[nextUploadIndex];nextUploadIndex++;uploadingFileCount++;task.state='checking';task.params.onTaskStart&&task.params.onTaskStart(formatTask(task));!task.params.UploadData&&(task.params.UploadData={});var apiParams=util.formatParams(task.api,task.params);originApiMap[task.api].call(cos,apiParams,function(err,data){if(!cos._isRunningTask(task.id))return;if(task.state==='checking'||task.state==='uploading'){task.state=err?'error':'success';err&&(task.error=err);uploadingFileCount--;emitListUpdate();startNextTask();task.callback&&task.callback(err,data);if(task.state==='success'){if(task.params){delete task.params.UploadData;delete task.params.Body;delete task.params;}delete task.callback;}}clearQueue();});emitListUpdate();// 异步执行下一个任务
  2420. setTimeout(startNextTask);};var killTask=function killTask(id,switchToState){var task=tasks[id];if(!task)return;var waiting=task&&task.state==='waiting';var running=task&&(task.state==='checking'||task.state==='uploading');if(switchToState==='canceled'&&task.state!=='canceled'||switchToState==='paused'&&waiting||switchToState==='paused'&&running){if(switchToState==='paused'&&task.params.Body&&typeof task.params.Body.pipe==='function'){console.error('stream not support pause');return;}task.state=switchToState;cos.emit('inner-kill-task',{TaskId:id,toState:switchToState});try{var UploadId=task&&task.params&&task.params.UploadData.UploadId;}catch(e){}if(switchToState==='canceled'&&UploadId)session.removeUsing(UploadId);emitListUpdate();if(running){uploadingFileCount--;startNextTask();}if(switchToState==='canceled'){if(task.params){delete task.params.UploadData;delete task.params.Body;delete task.params;}delete task.callback;}}clearQueue();};cos._addTasks=function(taskList){util.each(taskList,function(task){cos._addTask(task.api,task.params,task.callback,true);});emitListUpdate();};var isTaskReadyWarning=true;cos._addTask=function(api,params,callback,ignoreAddEvent){// 复制参数对象
  2421. params=util.formatParams(api,params);// 生成 id
  2422. var id=util.uuid();params.TaskId=id;params.onTaskReady&&params.onTaskReady(id);if(params.TaskReady){params.TaskReady(id);isTaskReadyWarning&&console.warn('warning: Param "TaskReady" has been deprecated. Please use "onTaskReady" instead.');isTaskReadyWarning=false;}var task={// env
  2423. params:params,callback:callback,api:api,index:queue.length,// task
  2424. id:id,Bucket:params.Bucket,Region:params.Region,Key:params.Key,FilePath:params.FilePath||'',state:'waiting',loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:params._custom};var onHashProgress=params.onHashProgress;params.onHashProgress=function(info){if(!cos._isRunningTask(task.id))return;task.hashPercent=info.percent;onHashProgress&&onHashProgress(info);emitListUpdate();};var onProgress=params.onProgress;params.onProgress=function(info){if(!cos._isRunningTask(task.id))return;task.state==='checking'&&(task.state='uploading');task.loaded=info.loaded;task.speed=info.speed;task.percent=info.percent;onProgress&&onProgress(info);emitListUpdate();};// 异步获取 filesize
  2425. util.getFileSize(api,params,function(err,size){// 开始处理上传
  2426. if(err)return callback(util.error(err));// 如果获取大小出错,不加入队列
  2427. // 获取完文件大小再把任务加入队列
  2428. tasks[id]=task;queue.push(task);task.size=size;!ignoreAddEvent&&emitListUpdate();startNextTask();clearQueue();});return id;};cos._isRunningTask=function(id){var task=tasks[id];return!!(task&&(task.state==='checking'||task.state==='uploading'));};cos.getTaskList=function(){return util.map(queue,formatTask);};cos.cancelTask=function(id){killTask(id,'canceled');};cos.pauseTask=function(id){killTask(id,'paused');};cos.restartTask=function(id){var task=tasks[id];if(task&&(task.state==='paused'||task.state==='error')){task.state='waiting';emitListUpdate();nextUploadIndex=Math.min(nextUploadIndex,task.index);startNextTask();}};cos.isUploadRunning=function(){return uploadingFileCount||nextUploadIndex<queue.length;};};module.exports.transferToTaskMethod=transferToTaskMethod;module.exports.init=initTask;/***/},/***/"./src/tracker.js":/*!************************!*\
  2429. !*** ./src/tracker.js ***!
  2430. \************************/ /*! no static exports found */ /***/function srcTrackerJs(module,exports,__webpack_require__){var _classCallCheck=__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */"./node_modules/@babel/runtime/helpers/classCallCheck.js");var _createClass=__webpack_require__(/*! @babel/runtime/helpers/createClass */"./node_modules/@babel/runtime/helpers/createClass.js");var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");var pkg=__webpack_require__(/*! ../package.json */"./package.json");var beacon=null;var getBeacon=function getBeacon(delay){if(!beacon){// 不放在顶层是避免首次引入就被加载,从而避免在某些环境比如webworker里加载灯塔sdk内window相关对象报错
  2431. var BeaconAction=__webpack_require__(/*! ../lib/beacon.min */"./lib/beacon.min.js");beacon=new BeaconAction({appkey:'0AND0VEVB24UBGDU',versionCode:pkg.version,channelID:'js_sdk',//渠道,选填
  2432. openid:'openid',// 用户id, 选填
  2433. unionid:'unid',//用户unionid , 类似idfv,选填
  2434. strictMode:false,//严苛模式开关, 打开严苛模式会主动抛出异常, 上线请务必关闭!!!
  2435. delay:delay,// 普通事件延迟上报时间(单位毫秒), 默认1000(1秒),选填
  2436. sessionDuration:60*1000// session变更的时间间隔, 一个用户持续30分钟(默认值)没有任何上报则算另一次 session,每变更一次session上报一次启动事件(rqd_applaunched),使用毫秒(ms),最小值30秒,选填
  2437. });}return beacon;};var utils={// 生成uid 每个链路对应唯一一条uid
  2438. getUid:function getUid(){var S4=function S4(){return((1+Math.random())*0x10000|0).toString(16).substring(1);};return S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4();},// 获取网络类型
  2439. getNetType:function getNetType(){if((typeof navigator==="undefined"?"undefined":_typeof(navigator))==='object'){var connection=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return(connection===null||connection===void 0?void 0:connection.type)||(connection===null||connection===void 0?void 0:connection.effectiveType)||'unknown';}return'unknown';},// 获取pc端操作系统类型
  2440. getOsType:function getOsType(){if((typeof navigator==="undefined"?"undefined":_typeof(navigator))!=='object'){return'unknown os';}var agent=navigator.userAgent.toLowerCase();var isMac=/macintosh|mac os x/i.test(navigator.userAgent);if(agent.indexOf('win32')>=0||agent.indexOf('wow32')>=0){return'win32';}if(agent.indexOf('win64')>=0||agent.indexOf('wow64')>=0){return'win64';}if(isMac){return'mac';}return'unknown os';},isMobile:function isMobile(){var exp=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i;if((typeof navigator==="undefined"?"undefined":_typeof(navigator))==='object'&&navigator.userAgent.match(exp)){return true;// 移动端
  2441. }return false;// PC端
  2442. },isAndroid:function isAndroid(){var exp=/(Android|Adr|Linux)/i;if((typeof navigator==="undefined"?"undefined":_typeof(navigator))==='object'&&navigator.userAgent.match(exp)){return true;}return false;},isIOS:function isIOS(){var exp=/(iPhone|iPod|iPad|iOS)/i;if((typeof navigator==="undefined"?"undefined":_typeof(navigator))==='object'&&navigator.userAgent.match(exp)){return true;}return false;},isOtherMobile:function isOtherMobile(){return isMobile&&!isAndroid&&!isIOS;},// 获取浏览器类型
  2443. getDeviceName:function getDeviceName(){if((typeof navigator==="undefined"?"undefined":_typeof(navigator))!=='object'){return'unknown device';}var explorer=navigator.userAgent.toLowerCase();// 腾讯会议内置浏览器
  2444. if(explorer.includes('app/tencent_wemeet')){return'tencent_wemeet';}// 遨游浏览器
  2445. if(explorer.indexOf('maxthon')>=0){var match=explorer.match(/maxthon\/([\d.]+)/);var ver=match&&match[1]||'';return"\u50B2\u6E38\u6D4F\u89C8\u5668 ".concat(ver).trim();}// QQ浏览器
  2446. if(explorer.indexOf('qqbrowser')>=0){var _match=explorer.match(/qqbrowser\/([\d.]+)/);var _ver=_match&&_match[1]||'';return"QQ\u6D4F\u89C8\u5668 ".concat(_ver).trim();}// 搜狗浏览器
  2447. if(explorer.indexOf('se 2.x')>=0){return'搜狗浏览器';}// 微信浏览器
  2448. if(explorer.indexOf('wxwork')>=0){return'微信内置浏览器';}// ie
  2449. if(explorer.indexOf('msie')>=0){var _match2=explorer.match(/msie ([\d.]+)/);var _ver2=_match2&&_match2[1]||'';return"IE ".concat(_ver2).trim();}// firefox
  2450. if(explorer.indexOf('firefox')>=0){var _match3=explorer.match(/firefox\/([\d.]+)/);var _ver3=_match3&&_match3[1]||'';return"Firefox ".concat(_ver3).trim();}// Chrome
  2451. if(explorer.indexOf('chrome')>=0){var _match4=explorer.match(/chrome\/([\d.]+)/);var _ver4=_match4&&_match4[1]||'';return"Chrome ".concat(_ver4).trim();}// Opera
  2452. if(explorer.indexOf('opera')>=0){var _match5=explorer.match(/opera.([\d.]+)/);var _ver5=_match5&&_match5[1]||'';return"Opera ".concat(_ver5).trim();}// Safari
  2453. if(explorer.indexOf('safari')>=0){var _match6=explorer.match(/version\/([\d.]+)/);var _ver6=_match6&&_match6[1]||'';return"Safari ".concat(_ver6).trim();}if(explorer.indexOf('edge')>=0){var _match7=explorer.match(/edge\/([\d.]+)/);var _ver7=_match7&&_match7[1]||'';return"edge ".concat(_ver7).trim();}return explorer.substr(0,200);}};var constant={isMobile:utils.isMobile(),isBrowser:!utils.isMobile(),mobileOsType:utils.isAndroid()?'android':utils.isIOS?'ios':'other_mobile',pcOsType:utils.getOsType()};// 设备信息,只取一次值
  2454. var deviceInfo={// ↓上报项
  2455. deviceType:constant.isMobile?'mobile':constant.isBrowser?'browser':'unknown',devicePlatform:constant.isMobile?constant.mobileOsType:constant.pcOsType,deviceName:utils.getDeviceName()//浏览器名称
  2456. };// 分块上传原子方法
  2457. var sliceUploadMethods=['multipartInit','multipartUpload','multipartComplete','multipartList','multipartListPart','multipartAbort'];var uploadApi=['putObject','postObject','appendObject','sliceUploadFile','uploadFile','uploadFiles'].concat(sliceUploadMethods);var downloadApi=['getObject'];function getEventCode(apiName){if(uploadApi.includes(apiName)){return'cos_upload';}if(downloadApi.includes(apiName)){return'cos_download';}return'base_service';}// 上报参数驼峰改下划线
  2458. function camel2underline(key){return key.replace(/([A-Z])/g,'_$1').toLowerCase();}function formatParams(params){var formattedParams={};var allReporterKeys=['tracePlatform','cossdkVersion','region','networkType','host','accelerate','requestPath','size','httpMd5','httpSign','httpFull','name','result','tookTime','errorNode','errorCode','errorMessage','errorRequestId','errorStatusCode','errorServiceName','errorType','traceId','bucket','appid','partNumber','retryTimes','reqUrl','customId','fullError','deviceType','devicePlatform','deviceName'];var successKeys=['tracePlatform','cossdkVersion','region','bucket','appid','networkType','host','accelerate','requestPath','partNumber','size','name','result','tookTime','errorRequestId','retryTimes','reqUrl','customId','deviceType','devicePlatform','deviceName'];// 需要上报的参数字段
  2459. var reporterKeys=params.result==='Success'?successKeys:allReporterKeys;for(var key in params){if(!reporterKeys.includes(key))continue;var formattedKey=camel2underline(key);formattedParams[formattedKey]=params[key];}return formattedParams;}// 链路追踪器
  2460. var Tracker=/*#__PURE__*/function(){function Tracker(opt){_classCallCheck(this,Tracker);var parent=opt.parent,traceId=opt.traceId,bucket=opt.bucket,region=opt.region,apiName=opt.apiName,fileKey=opt.fileKey,fileSize=opt.fileSize,accelerate=opt.accelerate,customId=opt.customId,delay=opt.delay,deepTracker=opt.deepTracker;var appid=bucket&&bucket.substr(bucket.lastIndexOf('-')+1)||'';this.parent=parent;this.deepTracker=deepTracker;this.delay=delay;// 上报用到的字段
  2461. this.params={// 通用字段
  2462. cossdkVersion:pkg.version,region:region,networkType:'',host:'',accelerate:accelerate?'Y':'N',requestPath:fileKey||'',size:fileSize||-1,httpMd5:0,// MD5耗时
  2463. httpSign:0,// 计算签名耗时
  2464. httpFull:0,// http请求耗时
  2465. name:apiName||'',result:'',// sdk api调用结果Success、Fail
  2466. tookTime:0,// 总耗时
  2467. errorNode:'',errorCode:'',errorMessage:'',errorRequestId:'',errorStatusCode:0,errorServiceName:'',// js补充字段
  2468. tracePlatform:'cos-js-sdk-v5',// 上报平台=js
  2469. traceId:traceId||utils.getUid(),// 每条上报唯一标识
  2470. bucket:bucket,appid:appid,partNumber:0,// 分块上传编号
  2471. retryTimes:0,// sdk内部发起的请求重试
  2472. reqUrl:'',// 请求url
  2473. customId:customId||'',// 业务id
  2474. deviceType:deviceInfo.deviceType,// 设备类型 移动端浏览器、web浏览器
  2475. devicePlatform:deviceInfo.devicePlatform,deviceName:deviceInfo.deviceName,md5StartTime:0,// md5计算开始时间
  2476. md5EndTime:0,// md5计算结束时间
  2477. signStartTime:0,// 计算签名开始时间
  2478. signEndTime:0,// 计算签名结束时间
  2479. httpStartTime:0,// 发起网络请求开始时间
  2480. httpEndTime:0,// 网路请求结束时间
  2481. startTime:new Date().getTime(),// sdk api调用起始时间,不是纯网络耗时
  2482. endTime:0// sdk api调用结束时间,不是纯网络耗时
  2483. };this.beacon=getBeacon(delay);}// 格式化sdk回调
  2484. _createClass(Tracker,[{key:"formatResult",value:function formatResult(err,data){var _err$error,_err$error2,_err$error3,_err$error4,_err$error5,_err$error6;var now=new Date().getTime();var tookTime=now-this.params.startTime;var networkType=utils.getNetType();var errorCode=err?(err===null||err===void 0?void 0:err.code)||(err===null||err===void 0?void 0:(_err$error=err.error)===null||_err$error===void 0?void 0:_err$error.code)||(err===null||err===void 0?void 0:(_err$error2=err.error)===null||_err$error2===void 0?void 0:_err$error2.Code):'';var errorMessage=err?(err===null||err===void 0?void 0:err.message)||(err===null||err===void 0?void 0:(_err$error3=err.error)===null||_err$error3===void 0?void 0:_err$error3.message)||(err===null||err===void 0?void 0:(_err$error4=err.error)===null||_err$error4===void 0?void 0:_err$error4.Message):'';var errorServiceName=err?(err===null||err===void 0?void 0:err.resource)||(err===null||err===void 0?void 0:(_err$error5=err.error)===null||_err$error5===void 0?void 0:_err$error5.resource)||(err===null||err===void 0?void 0:(_err$error6=err.error)===null||_err$error6===void 0?void 0:_err$error6.Resource):'';var errorStatusCode=err?err===null||err===void 0?void 0:err.statusCode:data.statusCode;var requestId=err?(err===null||err===void 0?void 0:err.headers)&&(err===null||err===void 0?void 0:err.headers['x-cos-request-id']):(data===null||data===void 0?void 0:data.headers)&&(data===null||data===void 0?void 0:data.headers['x-cos-request-id']);var errorType=err?requestId?'Server':'Client':'';Object.assign(this.params,{tookTime:tookTime,networkType:networkType,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:err?'Fail':'Success',errorType:errorType,errorCode:errorCode,errorStatusCode:errorStatusCode,errorMessage:errorMessage,errorServiceName:errorServiceName,errorRequestId:requestId});if(err&&(!errorCode||!errorMessage)){// 暂存全量err一段时间 观察是否所有err格式都可被解析
  2485. this.params.fullError=err?JSON.stringify(err):'';}if(this.params.name==='getObject'){this.params.size=data?data.headers&&data.headers['content-length']:-1;}if(this.params.reqUrl){try{var execRes=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=execRes[2];}catch(e){this.params.host=this.params.reqUrl;}}this.sendEvents();}// 设置当前链路的参数
  2486. },{key:"setParams",value:function setParams(params){Object.assign(this.params,params);}// 使用灯塔延时上报
  2487. },{key:"sendEvents",value:function sendEvents(){// DeepTracker模式下才会上报分块上传内部细节
  2488. if(sliceUploadMethods.includes(this.params.name)&&!this.deepTracker){return;}var eventCode=getEventCode(this.params.name);var formattedParams=formatParams(this.params);// 兜底处理
  2489. if(!this.beacon){this.beacon=getBeacon(this.delay||5000);}if(this.delay===0){// 实时上报
  2490. this.beacon&&this.beacon.onDirectUserAction(eventCode,formattedParams);}else{// 周期性上报
  2491. this.beacon&&this.beacon.onUserAction(eventCode,formattedParams);}}// 生成子实例,与父所属一个链路,可用于分块上传内部流程上报单个分块操作
  2492. },{key:"generateSubTracker",value:function generateSubTracker(subParams){Object.assign(subParams,{parent:this,deepTracker:this.deepTracker,traceId:this.params.traceId,bucket:this.params.bucket,region:this.params.region,fileKey:this.params.requestPath,customId:this.params.customId,delay:this.delay});return new Tracker(subParams);}}]);return Tracker;}();module.exports=Tracker;/***/},/***/"./src/util.js":/*!*********************!*\
  2493. !*** ./src/util.js ***!
  2494. \*********************/ /*! no static exports found */ /***/function srcUtilJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(process){var _typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");var md5=__webpack_require__(/*! ../lib/md5 */"./lib/md5.js");var CryptoJS=__webpack_require__(/*! ../lib/crypto */"./lib/crypto.js");var xml2json=__webpack_require__(/*! ../lib/xml2json */"./lib/xml2json.js");var json2xml=__webpack_require__(/*! ../lib/json2xml */"./lib/json2xml.js");var base64=__webpack_require__(/*! ../lib/base64 */"./lib/base64.js");var Tracker=__webpack_require__(/*! ./tracker */"./src/tracker.js");function camSafeUrlEncode(str){return encodeURIComponent(str).replace(/!/g,'%21').replace(/'/g,'%27').replace(/\(/g,'%28').replace(/\)/g,'%29').replace(/\*/g,'%2A');}function getObjectKeys(obj,forKey){var list=[];for(var key in obj){if(obj.hasOwnProperty(key)){list.push(forKey?camSafeUrlEncode(key).toLowerCase():key);}}return list.sort(function(a,b){a=a.toLowerCase();b=b.toLowerCase();return a===b?0:a>b?1:-1;});}/**
  2495. * obj转为string
  2496. * @param {Object} obj 需要转的对象,必须
  2497. * @param {Boolean} lowerCaseKey key是否转为小写,默认false,非必须
  2498. * @return {String} data 返回字符串
  2499. */var obj2str=function obj2str(obj,lowerCaseKey){var i,key,val;var list=[];var keyList=getObjectKeys(obj);for(i=0;i<keyList.length;i++){key=keyList[i];val=obj[key]===undefined||obj[key]===null?'':''+obj[key];key=lowerCaseKey?camSafeUrlEncode(key).toLowerCase():camSafeUrlEncode(key);val=camSafeUrlEncode(val)||'';list.push(key+'='+val);}return list.join('&');};// 可以签入签名的headers
  2500. var signHeaders=['cache-control','content-disposition','content-encoding','content-length','content-md5','expect','expires','host','if-match','if-modified-since','if-none-match','if-unmodified-since','origin','range','transfer-encoding'];var getSignHeaderObj=function getSignHeaderObj(headers){var signHeaderObj={};for(var i in headers){var key=i.toLowerCase();if(key.indexOf('x-cos-')>-1||signHeaders.indexOf(key)>-1){signHeaderObj[i]=headers[i];}}return signHeaderObj;};//测试用的key后面可以去掉
  2501. var getAuth=function getAuth(opt){opt=opt||{};var SecretId=opt.SecretId;var SecretKey=opt.SecretKey;var KeyTime=opt.KeyTime;var method=(opt.method||opt.Method||'get').toLowerCase();var queryParams=clone(opt.Query||opt.params||{});var headers=getSignHeaderObj(clone(opt.Headers||opt.headers||{}));var Key=opt.Key||'';var pathname;if(opt.UseRawKey){pathname=opt.Pathname||opt.pathname||'/'+Key;}else{pathname=opt.Pathname||opt.pathname||Key;pathname.indexOf('/')!==0&&(pathname='/'+pathname);}// ForceSignHost明确传入false才不加入host签名
  2502. var forceSignHost=opt.ForceSignHost===false?false:true;// 如果有传入存储桶且需要强制签名,那么签名默认加 Host 参与计算,避免跨桶访问
  2503. if(!headers.Host&&!headers.host&&opt.Bucket&&opt.Region&&forceSignHost)headers.Host=opt.Bucket+'.cos.'+opt.Region+'.myqcloud.com';if(!SecretId)throw new Error('missing param SecretId');if(!SecretKey)throw new Error('missing param SecretKey');// 签名有效起止时间
  2504. var now=Math.round(getSkewTime(opt.SystemClockOffset)/1000)-1;var exp=now;var Expires=opt.Expires||opt.expires;if(Expires===undefined){exp+=900;// 签名过期时间为当前 + 900s
  2505. }else{exp+=Expires*1||0;}// 要用到的 Authorization 参数列表
  2506. var qSignAlgorithm='sha1';var qAk=SecretId;var qSignTime=KeyTime||now+';'+exp;var qKeyTime=KeyTime||now+';'+exp;var qHeaderList=getObjectKeys(headers,true).join(';').toLowerCase();var qUrlParamList=getObjectKeys(queryParams,true).join(';').toLowerCase();// 签名算法说明文档:https://www.qcloud.com/document/product/436/7778
  2507. // 步骤一:计算 SignKey
  2508. var signKey=CryptoJS.HmacSHA1(qKeyTime,SecretKey).toString();// 步骤二:构成 FormatString
  2509. var formatString=[method,pathname,util.obj2str(queryParams,true),util.obj2str(headers,true),''].join('\n');// 步骤三:计算 StringToSign
  2510. var stringToSign=['sha1',qSignTime,CryptoJS.SHA1(formatString).toString(),''].join('\n');// 步骤四:计算 Signature
  2511. var qSignature=CryptoJS.HmacSHA1(stringToSign,signKey).toString();// 步骤五:构造 Authorization
  2512. var authorization=['q-sign-algorithm='+qSignAlgorithm,'q-ak='+qAk,'q-sign-time='+qSignTime,'q-key-time='+qKeyTime,'q-header-list='+qHeaderList,'q-url-param-list='+qUrlParamList,'q-signature='+qSignature].join('&');return authorization;};var readIntBE=function readIntBE(chunk,size,offset){var bytes=size/8;var buf=chunk.slice(offset,offset+bytes);new Uint8Array(buf).reverse();return new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[size](buf)[0];};var buf2str=function buf2str(chunk,start,end,isUtf8){var buf=chunk.slice(start,end);var str='';new Uint8Array(buf).forEach(function(charCode){str+=String.fromCharCode(charCode);});if(isUtf8)str=decodeURIComponent(escape(str));return str;};var parseSelectPayload=function parseSelectPayload(chunk){var header={};var body=buf2str(chunk);var result={records:[]};while(chunk.byteLength){var totalLength=readIntBE(chunk,32,0);var headerLength=readIntBE(chunk,32,4);var payloadRestLength=totalLength-headerLength-16;var offset=0;var content;chunk=chunk.slice(12);// 获取 Message 的 header 信息
  2513. while(offset<headerLength){var headerNameLength=readIntBE(chunk,8,offset);var headerName=buf2str(chunk,offset+1,offset+1+headerNameLength);var headerValueLength=readIntBE(chunk,16,offset+headerNameLength+2);var headerValue=buf2str(chunk,offset+headerNameLength+4,offset+headerNameLength+4+headerValueLength);header[headerName]=headerValue;offset+=headerNameLength+4+headerValueLength;}if(header[':event-type']==='Records'){content=buf2str(chunk,offset,offset+payloadRestLength,true);result.records.push(content);}else if(header[':event-type']==='Stats'){content=buf2str(chunk,offset,offset+payloadRestLength,true);result.stats=util.xml2json(content).Stats;}else if(header[':event-type']==='error'){var errCode=header[':error-code'];var errMessage=header[':error-message'];var err=new Error(errMessage);err.message=errMessage;err.name=err.code=errCode;result.error=err;}else;chunk=chunk.slice(offset+payloadRestLength+4);}return{payload:result.records.join(''),body:body};};var getSourceParams=function getSourceParams(source){var parser=this.options.CopySourceParser;if(parser)return parser(source);var m=source.match(/^([^.]+-\d+)\.cos(v6|-cdc|-cdz|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);if(!m)return null;return{Bucket:m[1],Region:m[3],Key:m[7]};};var noop=function noop(){};// 清除对象里值为的 undefined 或 null 的属性
  2514. var clearKey=function clearKey(obj){var retObj={};for(var key in obj){if(obj.hasOwnProperty(key)&&obj[key]!==undefined&&obj[key]!==null){retObj[key]=obj[key];}}return retObj;};var readAsBinaryString=function readAsBinaryString(blob,callback){var readFun;var fr=new FileReader();if(FileReader.prototype.readAsBinaryString){readFun=FileReader.prototype.readAsBinaryString;fr.onload=function(){callback(this.result);};}else if(FileReader.prototype.readAsArrayBuffer){// 在 ie11 添加 readAsBinaryString 兼容
  2515. readFun=function readFun(fileData){var binary='';var reader=new FileReader();reader.onload=function(e){var bytes=new Uint8Array(reader.result);var length=bytes.byteLength;for(var i=0;i<length;i++){binary+=String.fromCharCode(bytes[i]);}callback(binary);};reader.readAsArrayBuffer(fileData);};}else{console.error('FileReader not support readAsBinaryString');}readFun.call(fr,blob);};var fileSliceNeedCopy=function(){var compareVersion=function compareVersion(a,b){a=a.split('.');b=b.split('.');for(var i=0;i<b.length;i++){if(a[i]!==b[i]){return parseInt(a[i])>parseInt(b[i])?1:-1;}}return 0;};var check=function check(ua){if(!ua)return false;var ChromeVersion=(ua.match(/Chrome\/([.\d]+)/)||[])[1];var QBCoreVersion=(ua.match(/QBCore\/([.\d]+)/)||[])[1];var QQBrowserVersion=(ua.match(/QQBrowser\/([.\d]+)/)||[])[1];var need=ChromeVersion&&compareVersion(ChromeVersion,'53.0.2785.116')<0&&QBCoreVersion&&compareVersion(QBCoreVersion,'3.53.991.400')<0&&QQBrowserVersion&&compareVersion(QQBrowserVersion,'9.0.2524.400')<=0||false;return need;};return check(typeof navigator!=='undefined'&&navigator.userAgent);}();// 获取文件分片
  2516. var fileSlice=function fileSlice(file,start,end,isUseToUpload,callback){var blob;if(file.slice){blob=file.slice(start,end);}else if(file.mozSlice){blob=file.mozSlice(start,end);}else if(file.webkitSlice){blob=file.webkitSlice(start,end);}if(isUseToUpload&&fileSliceNeedCopy){var reader=new FileReader();reader.onload=function(e){blob=null;callback(new Blob([reader.result]));};reader.readAsArrayBuffer(blob);}else{callback(blob);}};// 获取文件内容的 MD5
  2517. var getBodyMd5=function getBodyMd5(UploadCheckContentMd5,Body,callback,onProgress){callback=callback||noop;if(UploadCheckContentMd5){if(typeof Body==='string'){callback(util.md5(Body,true));}else if(Blob&&Body instanceof Blob){util.getFileMd5(Body,function(err,md5){callback(md5);},onProgress);}else{callback();}}else{callback();}};// 获取文件 md5 值
  2518. var md5ChunkSize=1024*1024;var getFileMd5=function getFileMd5(blob,callback,onProgress){var size=blob.size;var loaded=0;var md5ctx=md5.getCtx();var next=function next(start){if(start>=size){var hash=md5ctx.digest('hex');callback(null,hash);return;}var end=Math.min(size,start+md5ChunkSize);util.fileSlice(blob,start,end,false,function(chunk){readAsBinaryString(chunk,function(content){chunk=null;md5ctx=md5ctx.update(content,true);loaded+=content.length;content=null;if(onProgress)onProgress({loaded:loaded,total:size,percent:Math.round(loaded/size*10000)/10000});next(start+md5ChunkSize);});});};next(0);};function clone(obj){return map(obj,function(v){return _typeof(v)==='object'&&v!==null?clone(v):v;});}function attr(obj,name,defaultValue){return obj&&name in obj?obj[name]:defaultValue;}function extend(target,source){each(source,function(val,key){target[key]=source[key];});return target;}function isArray(arr){return arr instanceof Array;}function isInArray(arr,item){var flag=false;for(var i=0;i<arr.length;i++){if(item===arr[i]){flag=true;break;}}return flag;}function makeArray(arr){return isArray(arr)?arr:[arr];}function each(obj,fn){for(var i in obj){if(obj.hasOwnProperty(i)){fn(obj[i],i);}}}function map(obj,fn){var o=isArray(obj)?[]:{};for(var i in obj){if(obj.hasOwnProperty(i)){o[i]=fn(obj[i],i);}}return o;}function filter(obj,fn){var iaArr=isArray(obj);var o=iaArr?[]:{};for(var i in obj){if(obj.hasOwnProperty(i)){if(fn(obj[i],i)){if(iaArr){o.push(obj[i]);}else{o[i]=obj[i];}}}}return o;}var b64=function b64(str){var i,len,char,res='';for(i=0,len=str.length/2;i<len;i++){char=parseInt(str[i*2]+str[i*2+1],16);res+=String.fromCharCode(char);}return btoa(res);};var uuid=function uuid(){var S4=function S4(){return((1+Math.random())*0x10000|0).toString(16).substring(1);};return S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4();};var hasMissingParams=function hasMissingParams(apiName,params){var Bucket=params.Bucket;var Region=params.Region;var Key=params.Key;var Domain=this.options.Domain;var checkBucket=!Domain||typeof Domain==='string'&&Domain.indexOf('{Bucket}')>-1;var checkRegion=!Domain||typeof Domain==='string'&&Domain.indexOf('{Region}')>-1;if(apiName.indexOf('Bucket')>-1||apiName==='deleteMultipleObject'||apiName==='multipartList'||apiName==='listObjectVersions'){if(checkBucket&&!Bucket)return'Bucket';if(checkRegion&&!Region)return'Region';}else if(apiName.indexOf('Object')>-1||apiName.indexOf('multipart')>-1||apiName==='sliceUploadFile'||apiName==='abortUploadTask'){if(checkBucket&&!Bucket)return'Bucket';if(checkRegion&&!Region)return'Region';if(!Key)return'Key';}return false;};var formatParams=function formatParams(apiName,params){// 复制参数对象
  2519. params=extend({},params);// 统一处理 Headers
  2520. if(apiName!=='getAuth'&&apiName!=='getV4Auth'&&apiName!=='getObjectUrl'){var Headers=params.Headers||{};if(params&&_typeof(params)==='object'){(function(){for(var key in params){if(params.hasOwnProperty(key)&&key.indexOf('x-cos-')>-1){Headers[key]=params[key];}}})();var headerMap={// params headers
  2521. 'x-cos-mfa':'MFA','Content-MD5':'ContentMD5','Content-Length':'ContentLength','Content-Type':'ContentType',Expect:'Expect',Expires:'Expires','Cache-Control':'CacheControl','Content-Disposition':'ContentDisposition','Content-Encoding':'ContentEncoding',Range:'Range','If-Modified-Since':'IfModifiedSince','If-Unmodified-Since':'IfUnmodifiedSince','If-Match':'IfMatch','If-None-Match':'IfNoneMatch','x-cos-copy-source':'CopySource','x-cos-copy-source-Range':'CopySourceRange','x-cos-metadata-directive':'MetadataDirective','x-cos-copy-source-If-Modified-Since':'CopySourceIfModifiedSince','x-cos-copy-source-If-Unmodified-Since':'CopySourceIfUnmodifiedSince','x-cos-copy-source-If-Match':'CopySourceIfMatch','x-cos-copy-source-If-None-Match':'CopySourceIfNoneMatch','x-cos-acl':'ACL','x-cos-grant-read':'GrantRead','x-cos-grant-write':'GrantWrite','x-cos-grant-full-control':'GrantFullControl','x-cos-grant-read-acp':'GrantReadAcp','x-cos-grant-write-acp':'GrantWriteAcp','x-cos-storage-class':'StorageClass','x-cos-traffic-limit':'TrafficLimit','x-cos-mime-limit':'MimeLimit',// SSE-C
  2522. 'x-cos-server-side-encryption-customer-algorithm':'SSECustomerAlgorithm','x-cos-server-side-encryption-customer-key':'SSECustomerKey','x-cos-server-side-encryption-customer-key-MD5':'SSECustomerKeyMD5',// SSE-COS、SSE-KMS
  2523. 'x-cos-server-side-encryption':'ServerSideEncryption','x-cos-server-side-encryption-cos-kms-key-id':'SSEKMSKeyId','x-cos-server-side-encryption-context':'SSEContext',// 上传时图片处理
  2524. 'Pic-Operations':'PicOperations'};util.each(headerMap,function(paramKey,headerKey){if(params[paramKey]!==undefined){Headers[headerKey]=params[paramKey];}});params.Headers=clearKey(Headers);}}return params;};var apiWrapper=function apiWrapper(apiName,apiFn){return function(params,callback){var self=this;// 处理参数
  2525. if(typeof params==='function'){callback=params;params={};}// 整理参数格式
  2526. params=formatParams(apiName,params);// tracker传递
  2527. var tracker;if(self.options.EnableTracker){if(params.calledBySdk==='sliceUploadFile'){// 分块上传内部方法使用sliceUploadFile的子链路
  2528. tracker=params.tracker&&params.tracker.generateSubTracker({apiName:apiName});}else if(['uploadFile','uploadFiles'].includes(apiName)){// uploadFile、uploadFiles方法在内部处理,此处不处理
  2529. tracker=null;}else{var fileSize=-1;if(params.Body){fileSize=typeof params.Body==='string'?params.Body.length:params.Body.size||params.Body.byteLength||-1;}tracker=new Tracker({bucket:params.Bucket,region:params.Region,apiName:apiName,fileKey:params.Key,fileSize:fileSize,deepTracker:self.options.DeepTracker,customId:self.options.CustomId,delay:self.options.TrackerDelay});}}params.tracker=tracker;// 代理回调函数
  2530. var formatResult=function formatResult(result){if(result&&result.headers){result.headers['x-cos-request-id']&&(result.RequestId=result.headers['x-cos-request-id']);result.headers['x-ci-request-id']&&(result.RequestId=result.headers['x-ci-request-id']);result.headers['x-cos-version-id']&&(result.VersionId=result.headers['x-cos-version-id']);result.headers['x-cos-delete-marker']&&(result.DeleteMarker=result.headers['x-cos-delete-marker']);}return result;};var _callback=function _callback(err,data){// 格式化上报参数并上报
  2531. tracker&&tracker.formatResult(err,data);callback&&callback(formatResult(err),formatResult(data));};var checkParams=function checkParams(){if(apiName!=='getService'&&apiName!=='abortUploadTask'){// 判断参数是否完整
  2532. var missingResult=hasMissingParams.call(self,apiName,params);if(missingResult){return'missing param '+missingResult;}// 判断 region 格式
  2533. if(params.Region){if(self.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(params.Region)){return'Region format error.';}}else{if(params.Region.indexOf('cos.')>-1){return'param Region should not be start with "cos."';}else if(!/^([a-z\d-]+)$/.test(params.Region)){return'Region format error.';}}// 判断 region 格式
  2534. if(!self.options.CompatibilityMode&&params.Region.indexOf('-')===-1&&params.Region!=='yfb'&&params.Region!=='default'&&params.Region!=='accelerate'){console.warn('warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224');}}// 兼容不带 AppId 的 Bucket
  2535. if(params.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(params.Bucket)){if(params.AppId){params.Bucket=params.Bucket+'-'+params.AppId;}else if(self.options.AppId){params.Bucket=params.Bucket+'-'+self.options.AppId;}else{return'Bucket should format as "test-1250000000".';}}if(params.AppId){console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).');delete params.AppId;}}// 如果 Key 是 / 开头,强制去掉第一个 /
  2536. if(!self.options.UseRawKey&&params.Key&&params.Key.substr(0,1)==='/'){params.Key=params.Key.substr(1);}}};var errMsg=checkParams();var isSync=['getAuth','getObjectUrl'].includes(apiName);if(typeof Promise==='function'&&!isSync&&!callback){return new Promise(function(resolve,reject){callback=function callback(err,data){err?reject(err):resolve(data);};if(errMsg)return _callback(util.error(new Error(errMsg)));apiFn.call(self,params,_callback);});}else{if(errMsg)return _callback(util.error(new Error(errMsg)));var res=apiFn.call(self,params,_callback);if(isSync)return res;}};};var throttleOnProgress=function throttleOnProgress(total,onProgress){var self=this;var size0=0;var size1=0;var time0=Date.now();var time1;var timer;function update(){timer=0;if(onProgress&&typeof onProgress==='function'){time1=Date.now();var speed=Math.max(0,Math.round((size1-size0)/((time1-time0)/1000)*100)/100)||0;var percent;if(size1===0&&total===0){percent=1;}else{percent=Math.floor(size1/total*100)/100||0;}time0=time1;size0=size1;try{onProgress({loaded:size1,total:total,speed:speed,percent:percent});}catch(e){}}}return function(info,immediately){if(info){size1=info.loaded;total=info.total;}if(immediately){clearTimeout(timer);update();}else{if(timer)return;timer=setTimeout(update,self.options.ProgressInterval);}};};var getFileSize=function getFileSize(api,params,callback){var size;if(typeof params.Body==='string'){params.Body=new Blob([params.Body],{type:'text/plain'});}else if(params.Body instanceof ArrayBuffer){params.Body=new Blob([params.Body]);}if(params.Body&&(params.Body instanceof Blob||params.Body.toString()==='[object File]'||params.Body.toString()==='[object Blob]')){size=params.Body.size;}else{callback(util.error(new Error('params body format error, Only allow File|Blob|String.')));return;}params.ContentLength=size;callback(null,size);};// 获取调正的时间戳
  2537. var getSkewTime=function getSkewTime(offset){return Date.now()+(offset||0);};var error=function error(err,opt){var sourceErr=err;err.message=err.message||null;if(typeof opt==='string'){err.error=opt;err.message=opt;}else if(_typeof(opt)==='object'&&opt!==null){extend(err,opt);if(opt.code||opt.name)err.code=opt.code||opt.name;if(opt.message)err.message=opt.message;if(opt.stack)err.stack=opt.stack;}if(typeof Object.defineProperty==='function'){Object.defineProperty(err,'name',{writable:true,enumerable:false});Object.defineProperty(err,'message',{enumerable:true});}err.name=opt&&opt.name||err.name||err.code||'Error';if(!err.code)err.code=err.name;if(!err.error)err.error=clone(sourceErr);// 兼容老的错误格式
  2538. return err;};var isWebWorker=function isWebWorker(){// 有限判断 worker 环境的 constructor name 其次用 worker 独有的 FileReaderSync 兜底 详细参考 https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Workers_API/Using_web_workers
  2539. return(typeof globalThis==="undefined"?"undefined":_typeof(globalThis))==='object'&&(globalThis.constructor.name==='DedicatedWorkerGlobalScope'||globalThis.FileReaderSync);};var isNode=function isNode(){// 得兜底 web worker 环境中 webpack 用了 process 插件之类的情况
  2540. return(typeof window==="undefined"?"undefined":_typeof(window))!=='object'&&(typeof process==="undefined"?"undefined":_typeof(process))==='object'&&"function"==='function'&&!isWebWorker();};var isCIHost=function isCIHost(url){return /^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(url);};//判断是否是ios
  2541. var isIOS=function(){if((typeof navigator==="undefined"?"undefined":_typeof(navigator))!=='object'){return false;}var u=navigator.userAgent;var isIOS=!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);//ios终端
  2542. return isIOS;}();// 判断是qq内置浏览器
  2543. var isQQ=function(){if((typeof navigator==="undefined"?"undefined":_typeof(navigator))!=='object'){return false;}return /\sQQ/i.test(navigator.userAgent);}();var encodeBase64=function encodeBase64(str,safe){var base64Str=base64.encode(str);// 万象使用的安全base64格式需要特殊处理
  2544. if(safe){base64Str=base64Str.replaceAll('+','-').replaceAll('/','_').replaceAll('=','');}return base64Str;};var util={noop:noop,formatParams:formatParams,apiWrapper:apiWrapper,xml2json:xml2json,json2xml:json2xml,md5:md5,clearKey:clearKey,fileSlice:fileSlice,getBodyMd5:getBodyMd5,getFileMd5:getFileMd5,b64:b64,extend:extend,isArray:isArray,isInArray:isInArray,makeArray:makeArray,each:each,map:map,filter:filter,clone:clone,attr:attr,uuid:uuid,camSafeUrlEncode:camSafeUrlEncode,throttleOnProgress:throttleOnProgress,getFileSize:getFileSize,getSkewTime:getSkewTime,error:error,obj2str:obj2str,getAuth:getAuth,parseSelectPayload:parseSelectPayload,getSourceParams:getSourceParams,isBrowser:true,isNode:isNode,isCIHost:isCIHost,isIOS_QQ:isIOS&&isQQ,encodeBase64:encodeBase64};module.exports=util;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../node_modules/process/browser.js */"./node_modules/process/browser.js"));/***/}/******/}));});})(cosJsSdkV5);var COS=/*@__PURE__*/getDefaultExportFromCjs(cosJsSdkV5.exports);var ossSwitch="tencent";var tencentBucket="daya-online-1303457149";var getUploadSign=exports('g',/*#__PURE__*/function(){var _ref9=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(params){var bucketName,filename,postData,ossType,bucket,file,tempPostData;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:bucketName=params.bucketName,filename=params.filename,postData=params.postData;ossType=ossSwitch;bucket=bucketName;file=filename;tempPostData={};bucket=tencentBucket;file="klx/"+filename;tempPostData={key:"klx/"+postData.key};return _context.abrupt("return",request.post("/api-website/open/getUploadSign",{data:{postData:tempPostData,pluginName:ossType,bucketName:bucket,filename:file},params:{pluginName:ossType}}));case 9:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref9.apply(this,arguments);};}());var onOnlyFileUpload=exports('o',/*#__PURE__*/function(){var _ref10=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(action,params){var file,errorObj,cos;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:file="";errorObj=null;console.log(params,"params");cos=new COS({Domain:"https://oss.dayaedu.com",getAuthorization:function(){var _getAuthorization=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(options,callback){return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:callback({Authorization:params.signature});case 1:case"end":return _context2.stop();}}},_callee2);}));function getAuthorization(_x4,_x5){return _getAuthorization.apply(this,arguments);}return getAuthorization;}()});_context3.next=6;return cos.uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:"klx/".concat(params.name),Body:params.file,SliceSize:1024*1024*500}).then(function(res){var _res$Location;if(((_res$Location=res.Location)===null||_res$Location===void 0?void 0:_res$Location.indexOf("http"))>=0){file=res.Location;}else{file="https://"+res.Location;}}).catch(function(error){errorObj=error;});case 6:if(!file){_context3.next=10;break;}return _context3.abrupt("return",file);case 10:throw new Error(errorObj);case 11:case"end":return _context3.stop();}}},_callee3);}));return function(_x2,_x3){return _ref10.apply(this,arguments);};}());var Cropper=defineComponent({name:'cropper',props:{cropperNo:{type:Function,default:function _default(data){}},cropperOk:{type:Function,default:function _default(data){}},bucket:{type:String,default:'daya'}},data:function data(){return{// ossUploadUrl: 'https://ks3-cn-beijing.ksyuncs.com/' + this.bucket,
  2545. ossUploadUrl:"https://".concat(this.bucket,".ks3-cn-beijing.ksyuncs.com/"),dataObj:{policy:'',signature:'',key:'',KSSAccessKeyId:'',acl:'public-read',name:''},visible:false,img:null,options:{img:'',//裁剪图片的地址
  2546. autoCrop:true,//是否默认生成截图框
  2547. autoCropWidth:180,//默认生成截图框宽度
  2548. autoCropHeight:180,//默认生成截图框高度
  2549. fixedBox:true,//是否固定截图框大小 不允许改变
  2550. full:false,enlarge:1,// 是否按照截图框比例输出 默认为1
  2551. previewsCircle:true,//预览图是否是原圆形
  2552. centerBox:true,outputType:'png',title:'修改头像',name:null// 文件名称
  2553. },previews:{},url:{upload:'/sys/common/saveToImgByStr'},submitLoading:false,myCropper:null};},methods:{edit:function edit(record){var options=this.options;this.visible=true;this.options=Object.assign({},options,record);console.log(this.options);},/**
  2554. * 取消截图
  2555. */cancelHandel:function cancelHandel(){this.visible=false;this.cropperNo();},/**
  2556. * 确认截图
  2557. */okHandel:function okHandel(){var _this3=this;this.myCropper.getCroppedCanvas({imageSmoothingQuality:'high'}).toBlob(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(data){var options,fileName,key,obj,res,uploadUrl;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_this3.submitLoading=true;options=_this3.options;fileName=(options.name?options.name.split('.')[0]:+new Date())+'.png';_context4.prev=3;key=new Date().getTime()+fileName;obj={filename:key,bucketName:_this3.bucket,postData:{filename:key,acl:'public-read',key:key}};// const res = await request.post('/api-website/getUploadSign', {
  2558. // data: obj
  2559. // })
  2560. _context4.next=8;return getUploadSign(obj);case 8:res=_context4.sent;_this3.dataObj={policy:res.data.policy,signature:res.data.signature,key:key,KSSAccessKeyId:res.data.kssAccessKeyId,acl:'public-read',name:key};_context4.next=12;return onOnlyFileUpload(_this3.ossUploadUrl,_objectSpread(_objectSpread({},_this3.dataObj),{},{file:data}));case 12:uploadUrl=_context4.sent;// const formData = new FormData()
  2561. // for (const key in this.dataObj) {
  2562. // formData.append(key, this.dataObj[key])
  2563. // }
  2564. // // this.blobToFile(data, fileName)
  2565. // formData.append('file', data, fileName)
  2566. // await umiRequest(this.ossUploadUrl, {
  2567. // method: 'POST',
  2568. // data: formData
  2569. // })
  2570. // console.log(this.ossUploadUrl + key)
  2571. // const uploadUrl = this.ossUploadUrl + key
  2572. _this3.cropperOk(uploadUrl);_context4.next=19;break;case 16:_context4.prev=16;_context4.t0=_context4["catch"](3);ElMessage.error(_context4.t0);case 19:_context4.prev=19;_this3.submitLoading=false;_this3.cancelHandel();return _context4.finish(19);case 23:case"end":return _context4.stop();}}},_callee4,null,[[3,16,19,23]]);}));return function(_x6){return _ref11.apply(this,arguments);};}());},//转成blob
  2573. blobToFile:function blobToFile(Blob,fileName){//兼容IE
  2574. Blob.lastModifiedDate=new Date();Blob.name=fileName;return Blob;},base64ToFile:function base64ToFile(urlData,fileName){var arr=urlData.split(',');var mime=arr[0].match(/:(.*?);/)[1];var bytes=atob(arr[1]);// 解码base64
  2575. var n=bytes.length;var ia=new Uint8Array(n);while(n--){ia[n]=bytes.charCodeAt(n);}return new File([ia],fileName,{type:mime});},//移动框的事件
  2576. realTime:function realTime(data){this.previews=data;},//图片缩放
  2577. changeScale:function changeScale(num){num=num||1;this.$refs.cropperRef.changeScale(num);},//向左旋转
  2578. rotateLeft:function rotateLeft(){this.$refs.cropperRef.rotateLeft();},//向右旋转
  2579. rotateRight:function rotateRight(){this.$refs.cropperRef.rotateRight();},initImgCropper:function initImgCropper(){this.myCropper=new Cropper$1(this.$refs.imgCropper,{viewMode:1,//定义裁剪器的视图模式。如果将viewMode设置为0,则裁剪框可以延伸到画布外部,而值为1、2或3将限制裁剪框的大小为画布的大小。viewMode为2或3会将画布限制为容器。请注意,如果画布和容器的比例相同,则2和3之间没有差别。
  2580. dragMode:'move',//定义的拖动模式裁剪器.canvas和容器一样,2和3没有区别。move:移动画布 crop:创建新的裁剪框(默认) none:什么也不做
  2581. //定义裁剪框的固定纵横比。默认情况下,裁剪框为自由比率。
  2582. aspectRatio:this.options.autoCropWidth/this.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,//定义0到1之间的fA编号。定义自动裁剪区域大小(百分比)。默认0.8
  2583. cropBoxMovable:true,//允许通过拖动移动裁剪框。默认true
  2584. cropBoxResizable:false,//以通过拖动来调整裁剪框的大小 默认true
  2585. background:false,//显示容器的网格背景
  2586. movable:true,//移动图像
  2587. modal:true,preview:'.before'});}},render:function render(){var _this4=this;return createVNode(ElDialog,{"modelValue":this.visible,"onUpdate:modelValue":function onUpdateModelValue(val){return _this4.visible=val;},"appendToBody":true,"title":this.options.title,"closeOnClickModal":false,"width":'900px',"destroyOnClose":true,"onOpened":function onOpened(){_this4.initImgCropper();}},{default:function _default(){return[createVNode(ElRow,null,{default:function _default(){return[createVNode(ElCol,{"xs":24,"md":12,"style":{width:'350px'}},{default:function _default(){return[createVNode("div",{"class":styles.imgwarp},[createVNode("img",{"ref":"imgCropper","id":"myImages","src":_this4.options.img,"alt":"","style":{height:'350px'}},null)])];}}),createVNode(ElCol,{"xs":24,"md":12,"style":{height:'350px'}},{default:function _default(){return[createVNode("div",{"class":styles.previewImg},[createVNode("span",null,[createTextVNode("\u9884\u89C8\u56FE\u7247")]),createVNode("div",{"class":[_this4.options.previewsCircle?styles['avatar-upload-preview']:styles['avatar-upload-preview_range'],'before'],"style":{width:_this4.options.autoCropWidth+'px',height:_this4.options.autoCropHeight+'px'}},null)])];}})];}})];},footer:function footer(){return createVNode("span",{"class":"dialog-footer !text-center block"},[createVNode(ElButton,{"onClick":_this4.cancelHandel,"disabled":_this4.submitLoading},{default:function _default(){return[createTextVNode("\u53D6\u6D88")];}}),createVNode(ElButton,{"type":"primary","onClick":_this4.okHandel,"loading":_this4.submitLoading},{default:function _default(){return[createTextVNode("\u4FDD \u5B58")];}})]);}});}});var ColCropper=exports('C',defineComponent({name:'col-cropper',props:{modelValue:{type:String,default:''},options:{// 裁切需要参数
  2588. type:Object,default:{autoCrop:true,//是否默认生成截图框
  2589. enlarge:1,// 图片放大倍数
  2590. autoCropWidth:200,//默认生成截图框宽度
  2591. autoCropHeight:200,//默认生成截图框高度
  2592. fixedBox:true,//是否固定截图框大小 不允许改变
  2593. previewsCircle:true,//预览图是否是原圆形
  2594. title:'上传图片'}},// 显示图片原始图片
  2595. showSize:{type:Boolean,default:false},disabled:{type:Boolean,default:false},bucket:{type:String,default:'daya'},size:{type:Number,default:5// 默认5M
  2596. },accept:{type:String,default:'.png,.jpg,.jpeg'},tips:{type:String,default:'请上传图片'},extraTips:{type:String,default:'图片最大不能超过5MB'},cropUploadSuccess:{type:Function,default:function _default(data){}},domSize:{type:Object,default:{width:'150px',height:'85px'}}},data:function data(){return{isStopRun:false,loading:false};},methods:{onDelete:function onDelete(){// 删除图片
  2597. this.$emit('update:modelValue','');},//从本地选择文件
  2598. handleChange:function handleChange(info){var _this5=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee5(){var options;return regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:if(!_this5.isStopRun){_context5.next=2;break;}return _context5.abrupt("return");case 2:_this5.loading=true;options=_this5.options;_this5.getBase64(info.file,function(imageUrl){var target=Object.assign({},options,{img:imageUrl,name:info.file.name// 上传文件名
  2599. });_this5.$refs.CropperModal.edit(target);});case 5:case"end":return _context5.stop();}}},_callee5);}))();},// 上传之前 格式与大小校验
  2600. beforeUpload:function beforeUpload(file){this.isStopRun=false;var fileType=file.type;if(fileType.indexOf('image')<0){ElMessage.warning('请上传图片');this.isStopRun=true;return false;}// const isJpgOrPng = this.acceptArray.includes(file.type)
  2601. // if (!isJpgOrPng) {
  2602. // ElMessage.error('你上传图片格式不正确!')
  2603. // this.isStopRun = true
  2604. // }
  2605. // console.log(this.size)
  2606. var size=this.size||0;var isLtSize=file.size<size*1024*1024;if(!isLtSize){ElMessage.error('图片大小不能超过'+this.size+'MB!');this.isStopRun=true;}return isLtSize;},error:function error(){this.remove();this.loading=false;},remove:function remove(){this.onDelete();},//获取服务器返回的地址
  2607. handleCropperSuccess:function handleCropperSuccess(data){//将返回的数据回显
  2608. this.loading=false;// console.log(data, 'success')
  2609. this.$emit('update:modelValue',data);this.cropUploadSuccess(data);// this.$emit('cropUploadSuccess', data)
  2610. // console.log(this.modelValue, 'modelValue')
  2611. },// 取消上传
  2612. handleCropperClose:function handleCropperClose(){this.loading=false;this.remove();},getBase64:function getBase64(img,callback){var reader=new FileReader();reader.addEventListener('load',function(){return callback(reader.result);});reader.readAsDataURL(img);}},render:function render(){var _this6=this;return createVNode("div",{"class":[styles.colUpload,'w-full'],"style":{lineHeight:0}},[createVNode(ElUpload,{"disabled":this.disabled,"showFileList":false,"accept":this.accept,"beforeUpload":this.beforeUpload,"httpRequest":this.handleChange,"ref":"uploadRef"},{default:function _default(){return[createVNode("div",{"ref":"uploadDom","class":[styles.uploadClass,'w-full'],"style":{height:_this6.domSize.height,width:_this6.domSize.width}},[_this6.modelValue?createVNode(ElImage,{"src":_this6.modelValue,"fit":"cover","style":{height:_this6.domSize.height,width:_this6.domSize.width},"class":styles.uploadSection},null):createVNode("div",{"class":[styles.uploadSection,'flex items-center flex-col justify-center'],"style":{height:_this6.domSize.height,width:_this6.domSize.width}},[createVNode("img",{"src":iconUpload,"class":"w-8 h-7 mb-3"},null),createVNode("p",null,[_this6.tips])])])];}}),createVNode("p",{"class":"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips]),createVNode(Cropper,{"ref":"CropperModal","bucket":this.bucket,"cropperNo":this.handleCropperClose,"cropperOk":this.handleCropperSuccess},null)]);}}));}};});})();