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J;SAAA,MAAA;AAGI,eAAA,2CAAA;;YACI,GAAG,CAAC,IAAJ,CAAS,MAAM,CAAC,IAAP,CAAY,GAAZ,CAAT;AADJ,WAHJ;;QAMA,MAAM,CAAC,IAAP,CAAY,GAAZ;AAEA,aAAA,2CAAA;;UACI,GAAA,GAAM;AACN,eAAA,0CAAA;;YACI,GAAG,CAAC,IAAJ,CAAS,CAAT;AADJ;AAGA,eAAA,2CAAA;;YACI,GAAA,GAAM,SAAS,CAAC,aAAV,CAAwB,MAAxB,EAAgC,MAAhC;YACN,IAAG,mBAAH;cACI,GAAG,CAAC,IAAJ,CAAS,GAAG,CAAC,KAAJ,CAAA,CAAT,EADJ;aAAA,MAAA;cAGI,GAAG,CAAC,IAAJ,CAAS,EAAT,EAHJ;;AAFJ;UAMA,MAAM,CAAC,IAAP,CAAY,GAAZ;AAXJ;QAYA,IAAA,GAAO;AACP,aAAA,0CAAA;;UACI,IAAA,IAAQ,CAAC,CAAC,IAAF,CAAO,IAAP,CAAA,GAAa;AADzB;AAGA,eAAO,CAAA,CAAE,YAAF,CAAe,CAAC,IAAhB,CAAqB,IAArB,CAA0B,CAAC,GAA3B,CACC;UAAA,KAAA,EAAO,CAAC,CAAA,CAAE,MAAF,CAAS,CAAC,KAAV,CAAA,CAAA,GAAoB,CAArB,CAAA,GAA0B,IAAjC;UACA,MAAA,EAAQ,CAAC,CAAA,CAAE,MAAF,CAAS,CAAC,MAAV,CAAA,CAAA,GAAqB,CAAtB,CAAA,GAA2B,IADnC;SADD;MAzCuC,CAAd;;EAFzB,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\n    if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n        pivotModule require(\"jquery\")\n    else if typeof define is \"function\" and define.amd # AMD\n        define [\"jquery\"], pivotModule\n    # Plain browser env\n    else\n        pivotModule jQuery\n\ncallWithJQuery ($) ->\n\n    $.pivotUtilities.export_renderers = \"TSV Export\": (pivotData, opts) ->\n        defaults = localeStrings: {}\n\n        opts = $.extend(true, {}, defaults, opts)\n\n        rowKeys = pivotData.getRowKeys()\n        rowKeys.push [] if rowKeys.length == 0\n        colKeys = pivotData.getColKeys()\n        colKeys.push [] if colKeys.length == 0\n        rowAttrs = pivotData.rowAttrs\n        colAttrs = pivotData.colAttrs\n\n        result = []\n\n        row = []\n        for rowAttr in rowAttrs\n            row.push rowAttr\n        if colKeys.length == 1 and colKeys[0].length == 0\n            row.push pivotData.aggregatorName\n        else\n            for colKey in colKeys\n                row.push colKey.join(\"-\")\n\n        result.push row\n\n        for rowKey in rowKeys\n            row = []\n            for r in rowKey\n                row.push r\n\n            for colKey in colKeys\n                agg = pivotData.getAggregator(rowKey, colKey)\n                if agg.value()?\n                    row.push agg.value()\n                else\n                    row.push \"\"\n            result.push row\n        text = \"\"\n        for r in result\n            text += r.join(\"\\t\")+\"\\n\"\n\n        return $(\"<textarea>\").text(text).css(\n                width: ($(window).width() / 2) + \"px\",\n                height: ($(window).height() / 2) + \"px\")\n\n"]}